-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fpco 26696 - Framework agnostic final PR #62
base: main
Are you sure you want to change the base?
Conversation
README.md
Outdated
|
||
If you wish to develop an extension in a framework other than Express, Nest.js, or Fastify, refer to the documentation below. | ||
|
||
>The process of integrating OAuth functionality into an existing extension involves creating specific routes within the extension. These routes, namely `/fp/install`, `/fp/auth`, `/fp/autoinstall`, and `/fp/uninstall`, play a crucial role in OAuth implementation. It is essential to attach a `routerHandler` to each of these created routes, which can be obtained from the `setupfdk` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all are not related with OAuth, we don't want to expose /fp/autoinstall to externals as autoinstall is internal usecase only @jinalviranii
README.md
Outdated
|
||
>The process of integrating OAuth functionality into an existing extension involves creating specific routes within the extension. These routes, namely `/fp/install`, `/fp/auth`, `/fp/autoinstall`, and `/fp/uninstall`, play a crucial role in OAuth implementation. It is essential to attach a `routerHandler` to each of these created routes, which can be obtained from the `setupfdk` function. | ||
|
||
> The `fpInstall` function call requires three parameters: company_id, application_id, and exe data (extension exposed through the setupfdk method). This call will return the redirect URL of an extension consent page and session data that must be sent back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also mention /fp/install along with /fp/install
, exe data ? Elaborate more what /fp/install exactly does @jinalviranii
README.md
Outdated
|
||
> The `fpInstall` function call requires three parameters: company_id, application_id, and exe data (extension exposed through the setupfdk method). This call will return the redirect URL of an extension consent page and session data that must be sent back. | ||
|
||
> The `fpAuth` function call takes five arguments: reqobject, state, code, ext and sessionId. Request object must contain valid sessionId. This call will return the redirect URL of an installed extension and the session data that must be sent back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain each hooks job with detail @jinalviranii
README.md
Outdated
const handlers = fdkClient.routerHandlers; // Functions that constains implementaion of OAuth | ||
|
||
router.get("/fp/install", async (req, res, next) => { | ||
const { redirectUrl, fdkSession } = await handlers.fpInstall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can handlers have better naming convention instead of fpInstall
to extInstall
or something more generic @jinalviranii
README.md
Outdated
res.redirect(redirectUrl); */ | ||
}); | ||
|
||
router.post("/fp/auto_install", async (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this @jinalviranii
README.md
Outdated
| api_secret | API Secret of an extension for authentication. | | ||
| base_url? | Base URL for extension. | | ||
| scopes? | An array of scopes indicating the specific permissions needed for an extension. | | ||
| callbacks | The callback function to handle extension-related tasks. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elaborates more @jinalviranii
README.md
Outdated
| base_url? | Base URL for extension. | | ||
| scopes? | An array of scopes indicating the specific permissions needed for an extension. | | ||
| callbacks | The callback function to handle extension-related tasks. | | ||
| storage | An instance of storage (e.g., RedisStorage) for data storage. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be able to guide that this is explicitly used for sessionStorage
README.md
Outdated
| access_mode | Access mode of an extension. It can be `online` or `offline`. | | ||
| cluster? | The API url of the Fynd Platform cluster. | | ||
| debug? | Enable debug logs if it is `true`. Value can be `true` or `false`. | | ||
| [webhook_config](https://github.com/gofynd/fdk-extension-javascript?tab=readme-ov-file#parameter-table-for-webhook-configuration) | Necessary configuration for webhooks. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have relative link here instead of full URL @jinalviranii ?
README.md
Outdated
#### Parameter table for `event_map` object | ||
| Parameter | Description | | ||
| ------------- | ------------- | | ||
| key | API endpoint to process webhooks event. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jinalviranii I don't think key is here referring to Webhook endpoint, please cross check once
```javascript | ||
const fastify = require("fastify"); | ||
const { setupFdk } = require("fdk-extension-javascript/fastify"); | ||
const { RedisStorage } = require("fdk-extension-javascript/storage"); // Import RedisStorage (default storage class). Use your custom class if you have implemented other databases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jinalviranii Make sure we use SQLlite storage everywhere for by default
README.md
Outdated
FDK Extension Helper Library | ||
The FDK Extension JavaScript library is designed to streamline the implementation of OAuth for accessing Fynd Platform APIs and managing webhook subscriptions. This library offers built-in support for Express, Nest.js, and Fastify frameworks. Additionally, it provides flexibility for developing extensions in your preferred framework beyond the default support. | ||
|
||
This readme provides step-by-step guidance on implementing FDK extensions in different frameworks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to bottom of Readme.md file @jinalviranii
No description provided.