Skip to content

Commit c71c280

Browse files
committed
fix(continueTo): resupport continueTo
1 parent 1d1a302 commit c71c280

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Config properties:
5353
response_type, // string; // Tells the authorization server which grant to execute.
5454
scope, // string[]; // A list of permissions that the application requires.
5555
redirectUri, // string; // URI to return the user to after authorization is complete.
56+
continueTo, // string; // [optional] Parameter appended as `continue` to the `redirectUri`.
5657
locale, // string; // [optional] To force the display to a specific language (e.g.: en-AU)
5758
state, // string; // [optional] An opaque value, used for security purposes. If this request parameter is set in the request, then it is returned to the application as part of the redirect_uri.
5859
appToken, // string; // [optional] The Access Token granted through oauth
File renamed without changes.

src/index.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DOMAIN, MY_ACCOUNT, VAULT } from './endpoints';
44

55
interface IConfig {
66
clientId: string;
7-
scope: string[];
7+
scope?: string[];
88
isTestEnvironment?: boolean;
99
redirectUri?: string;
1010
continueTo?: string;
@@ -16,13 +16,14 @@ interface IConfig {
1616
interface IParams {
1717
client_id: string;
1818
locale?: string;
19+
continueTo?: string;
1920
}
2021

21-
interface IOauthParams {
22+
export interface IOauthParams {
2223
client_id: string;
2324
redirect_uri: string;
2425
response_type: string;
25-
scope: string;
26+
scope?: string;
2627
state?: string;
2728
}
2829

@@ -65,19 +66,21 @@ class LinkSDK {
6566
responseType = 'token',
6667
scope = [],
6768
locale,
68-
state
69+
state,
70+
continueTo
6971
} = config;
7072

7173
this.params = {
7274
client_id: clientId,
73-
locale
75+
locale,
76+
continueTo
7477
};
7578

7679
this.oauthParams = {
7780
client_id: clientId,
7881
redirect_uri: redirectUri,
7982
response_type: responseType,
80-
scope: scope.join(' '),
83+
scope: scope.length ? scope.join(' ') : undefined,
8184
state
8285
};
8386

@@ -93,13 +96,14 @@ class LinkSDK {
9396
const { newTab = false, email, authPage, backTo, showAuthToggle } = options;
9497

9598
const params = encodeConfigWithParams(
96-
{ ...this.oauthParams, ...this.params }, {
97-
email,
98-
sdk_platform: 'js',
99-
sdk_version: VERSION,
100-
auth_action: authPage,
101-
back_to: backTo,
102-
show_auth_toggle: showAuthToggle
99+
{ ...this.oauthParams, ...this.params },
100+
{
101+
email,
102+
sdk_platform: 'js',
103+
sdk_version: VERSION,
104+
auth_action: authPage,
105+
back_to: backTo,
106+
show_auth_toggle: showAuthToggle
103107
}
104108
);
105109

0 commit comments

Comments
 (0)