You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,20 +158,26 @@ This API has exactly the same parameters as `onboard`, the only difference being
158
158
159
159
### exchangeToken
160
160
161
-
Since we are using PKCE/Code grant, we will have to exchange the `code` for a token. You can optionally pass `code` via options parameter or it will fallback to automatically extract it from the browser URL.
161
+
Use this function to exchange an authorization `code` for a token. You can optionally pass `code` via options parameter, otherwise it will automatically extract the `code` URL parameter of the current URL.
162
162
163
-
`code`will be invalidated (can be used only once) after exchanged for a token, it is your responsibility to store the token yourself as the SDK does not store it internally.
163
+
The `code` can be used only once. The SDK does not store it internally, you have to store it in your application.
164
164
165
165
Refer [here](https://www.oauth.com/oauth2-servers/pkce/authorization-code-exchange/) for more details.
166
166
167
167
<h6>Usage:</h6>
168
168
169
-
One way to use this API is by calling it in the script on your redirection page. For example, if `authorize` redirects to `https://yourapp.com/callback?code=somecode`, you can call this function in the script loaded on that redirection page and the client library will automatically extract the code to exchange for a token.
169
+
One way to use this API is by calling it on your redirection page. For example, if `authorize` redirects to `https://yourapp.com/callback?code=somecode`, you can call this function in the script loaded on that redirection page and the client library will automatically extract the code to exchange for a token.
170
170
171
171
Alternatively, you can extract the `code` manually from the redirect URL and pass it to this function via the options object yourself.
172
172
173
173
```javascript
174
174
consttoken=awaitmtLinkSdk.exchangeToken(options);
175
+
token.access_token; // access token
176
+
token.refresh_token; // refresh token
177
+
token.token_type; // token type
178
+
token.created_at:// created at in seconds
179
+
token.expires_in; // expiry in seconds
180
+
token.scope; // scope of the token
175
181
```
176
182
177
183
| Parameter | Type | Required | Default Value | Description |
@@ -253,7 +259,7 @@ This method generates a URL to log out the guest. See the `logout` API for detai
253
259
mtLinkSdk.logoutUrl(options);
254
260
```
255
261
256
-
This API has exactly the same parameters as `logout`, the only difference being that it returns an URL instead of opening immediately with `window.open`.
262
+
This API has exactly the same parameters as `logout`, the only difference being that it returns an URL instead of opening immediately with `window.open`.
257
263
258
264
#### Open Vault Services Page
259
265
@@ -355,7 +361,7 @@ This method can generate URLs for various services provided by Moneytree, such a
355
361
mtLinkSdk.openServiceUrl(serviceId, options);
356
362
```
357
363
358
-
This API has exactly the same parameters as `openService`, the only difference being that it returns an URL instead of opening immediately with `window.open`.
364
+
This API has exactly the same parameters as `openService`, the only difference being that it returns an URL instead of opening immediately with `window.open`.
0 commit comments