@logto/client 2.6.3 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.cjs +4 -3
- package/lib/client.d.ts +5 -0
- package/lib/client.js +4 -3
- package/package.json +1 -1
package/lib/client.cjs
CHANGED
|
@@ -141,7 +141,7 @@ class StandardLogtoClient {
|
|
|
141
141
|
return js.fetchUserInfo(userinfoEndpoint, accessToken, this.adapter.requester);
|
|
142
142
|
}
|
|
143
143
|
async signIn(options, mode, hint) {
|
|
144
|
-
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, firstScreen, interactionMode, loginHint, directSignIn, extraParams, } = typeof options === 'string' || options instanceof URL
|
|
144
|
+
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, firstScreen, interactionMode, loginHint, directSignIn, extraParams, prompt, } = typeof options === 'string' || options instanceof URL
|
|
145
145
|
? {
|
|
146
146
|
redirectUri: options,
|
|
147
147
|
postRedirectUri: undefined,
|
|
@@ -150,11 +150,12 @@ class StandardLogtoClient {
|
|
|
150
150
|
loginHint: hint,
|
|
151
151
|
directSignIn: undefined,
|
|
152
152
|
extraParams: undefined,
|
|
153
|
+
prompt: undefined,
|
|
153
154
|
}
|
|
154
155
|
: options;
|
|
155
156
|
const redirectUri = redirectUriUrl.toString();
|
|
156
157
|
const postRedirectUri = postRedirectUriUrl?.toString();
|
|
157
|
-
const { appId: clientId, prompt, resources, scopes } = this.logtoConfig;
|
|
158
|
+
const { appId: clientId, prompt: promptViaConfig, resources, scopes } = this.logtoConfig;
|
|
158
159
|
const { authorizationEndpoint } = await this.getOidcConfig();
|
|
159
160
|
const [codeVerifier, state] = await Promise.all([
|
|
160
161
|
this.adapter.generateCodeVerifier(),
|
|
@@ -169,7 +170,7 @@ class StandardLogtoClient {
|
|
|
169
170
|
state,
|
|
170
171
|
scopes,
|
|
171
172
|
resources,
|
|
172
|
-
prompt,
|
|
173
|
+
prompt: prompt ?? promptViaConfig,
|
|
173
174
|
firstScreen,
|
|
174
175
|
interactionMode,
|
|
175
176
|
loginHint,
|
package/lib/client.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export type SignInOptions = {
|
|
|
12
12
|
* sign-in callback. If not specified, the user will stay on the `redirectUri` page.
|
|
13
13
|
*/
|
|
14
14
|
postRedirectUri?: string | URL;
|
|
15
|
+
/**
|
|
16
|
+
* The prompt parameter to be used for the authorization request.
|
|
17
|
+
* Note: If specified, it will override the prompt value in Logto configs.
|
|
18
|
+
*/
|
|
19
|
+
prompt?: SignInUriParameters['prompt'];
|
|
15
20
|
} & Pick<SignInUriParameters, 'interactionMode' | 'firstScreen' | 'loginHint' | 'directSignIn' | 'extraParams'>;
|
|
16
21
|
/**
|
|
17
22
|
* The Logto base client class that provides the essential methods for
|
package/lib/client.js
CHANGED
|
@@ -139,7 +139,7 @@ class StandardLogtoClient {
|
|
|
139
139
|
return fetchUserInfo(userinfoEndpoint, accessToken, this.adapter.requester);
|
|
140
140
|
}
|
|
141
141
|
async signIn(options, mode, hint) {
|
|
142
|
-
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, firstScreen, interactionMode, loginHint, directSignIn, extraParams, } = typeof options === 'string' || options instanceof URL
|
|
142
|
+
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, firstScreen, interactionMode, loginHint, directSignIn, extraParams, prompt, } = typeof options === 'string' || options instanceof URL
|
|
143
143
|
? {
|
|
144
144
|
redirectUri: options,
|
|
145
145
|
postRedirectUri: undefined,
|
|
@@ -148,11 +148,12 @@ class StandardLogtoClient {
|
|
|
148
148
|
loginHint: hint,
|
|
149
149
|
directSignIn: undefined,
|
|
150
150
|
extraParams: undefined,
|
|
151
|
+
prompt: undefined,
|
|
151
152
|
}
|
|
152
153
|
: options;
|
|
153
154
|
const redirectUri = redirectUriUrl.toString();
|
|
154
155
|
const postRedirectUri = postRedirectUriUrl?.toString();
|
|
155
|
-
const { appId: clientId, prompt, resources, scopes } = this.logtoConfig;
|
|
156
|
+
const { appId: clientId, prompt: promptViaConfig, resources, scopes } = this.logtoConfig;
|
|
156
157
|
const { authorizationEndpoint } = await this.getOidcConfig();
|
|
157
158
|
const [codeVerifier, state] = await Promise.all([
|
|
158
159
|
this.adapter.generateCodeVerifier(),
|
|
@@ -167,7 +168,7 @@ class StandardLogtoClient {
|
|
|
167
168
|
state,
|
|
168
169
|
scopes,
|
|
169
170
|
resources,
|
|
170
|
-
prompt,
|
|
171
|
+
prompt: prompt ?? promptViaConfig,
|
|
171
172
|
firstScreen,
|
|
172
173
|
interactionMode,
|
|
173
174
|
loginHint,
|