@logto/client 2.5.0 → 2.5.1
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 +9 -3
- package/lib/client.d.ts +5 -1
- package/lib/client.js +9 -3
- package/lib/mock.d.ts +2 -0
- package/package.json +2 -2
package/lib/client.cjs
CHANGED
|
@@ -140,9 +140,14 @@ class StandardLogtoClient {
|
|
|
140
140
|
}
|
|
141
141
|
return js.fetchUserInfo(userinfoEndpoint, accessToken, this.adapter.requester);
|
|
142
142
|
}
|
|
143
|
-
async signIn(options, mode) {
|
|
144
|
-
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, interactionMode, } = typeof options === 'string' || options instanceof URL
|
|
145
|
-
? {
|
|
143
|
+
async signIn(options, mode, hint) {
|
|
144
|
+
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, interactionMode, loginHint, } = typeof options === 'string' || options instanceof URL
|
|
145
|
+
? {
|
|
146
|
+
redirectUri: options,
|
|
147
|
+
postRedirectUri: undefined,
|
|
148
|
+
interactionMode: mode,
|
|
149
|
+
loginHint: hint,
|
|
150
|
+
}
|
|
146
151
|
: options;
|
|
147
152
|
const redirectUri = redirectUriUrl.toString();
|
|
148
153
|
const postRedirectUri = postRedirectUriUrl?.toString();
|
|
@@ -163,6 +168,7 @@ class StandardLogtoClient {
|
|
|
163
168
|
resources,
|
|
164
169
|
prompt,
|
|
165
170
|
interactionMode,
|
|
171
|
+
loginHint,
|
|
166
172
|
});
|
|
167
173
|
await Promise.all([
|
|
168
174
|
this.setSignInSession({ redirectUri, postRedirectUri, codeVerifier, state }),
|
package/lib/client.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export type SignInOptions = {
|
|
|
22
22
|
* @see {@link InteractionMode}
|
|
23
23
|
*/
|
|
24
24
|
interactionMode?: InteractionMode;
|
|
25
|
+
/**
|
|
26
|
+
* Login hint indicates the current user (usually an email address).
|
|
27
|
+
*/
|
|
28
|
+
loginHint?: string;
|
|
25
29
|
};
|
|
26
30
|
/**
|
|
27
31
|
* The Logto base client class that provides the essential methods for
|
|
@@ -140,7 +144,7 @@ export declare class StandardLogtoClient {
|
|
|
140
144
|
* @param redirectUri See {@link SignInOptions.redirectUri}.
|
|
141
145
|
* @param interactionMode See {@link SignInOptions.interactionMode}.
|
|
142
146
|
*/
|
|
143
|
-
signIn(redirectUri: SignInOptions['redirectUri'], interactionMode?: SignInOptions['interactionMode']): Promise<void>;
|
|
147
|
+
signIn(redirectUri: SignInOptions['redirectUri'], interactionMode?: SignInOptions['interactionMode'], loginHint?: SignInOptions['loginHint']): Promise<void>;
|
|
144
148
|
/**
|
|
145
149
|
* Check if the user is redirected from the sign-in page by checking if the
|
|
146
150
|
* current URL matches the redirect URI in the sign-in session.
|
package/lib/client.js
CHANGED
|
@@ -138,9 +138,14 @@ class StandardLogtoClient {
|
|
|
138
138
|
}
|
|
139
139
|
return fetchUserInfo(userinfoEndpoint, accessToken, this.adapter.requester);
|
|
140
140
|
}
|
|
141
|
-
async signIn(options, mode) {
|
|
142
|
-
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, interactionMode, } = typeof options === 'string' || options instanceof URL
|
|
143
|
-
? {
|
|
141
|
+
async signIn(options, mode, hint) {
|
|
142
|
+
const { redirectUri: redirectUriUrl, postRedirectUri: postRedirectUriUrl, interactionMode, loginHint, } = typeof options === 'string' || options instanceof URL
|
|
143
|
+
? {
|
|
144
|
+
redirectUri: options,
|
|
145
|
+
postRedirectUri: undefined,
|
|
146
|
+
interactionMode: mode,
|
|
147
|
+
loginHint: hint,
|
|
148
|
+
}
|
|
144
149
|
: options;
|
|
145
150
|
const redirectUri = redirectUriUrl.toString();
|
|
146
151
|
const postRedirectUri = postRedirectUriUrl?.toString();
|
|
@@ -161,6 +166,7 @@ class StandardLogtoClient {
|
|
|
161
166
|
resources,
|
|
162
167
|
prompt,
|
|
163
168
|
interactionMode,
|
|
169
|
+
loginHint,
|
|
164
170
|
});
|
|
165
171
|
await Promise.all([
|
|
166
172
|
this.setSignInSession({ redirectUri, postRedirectUri, codeVerifier, state }),
|
package/lib/mock.d.ts
CHANGED
|
@@ -26,9 +26,11 @@ export declare const postSignOutRedirectUri = "http://localhost:3000";
|
|
|
26
26
|
export declare const mockCodeChallenge = "code_challenge_value";
|
|
27
27
|
export declare const mockedCodeVerifier = "code_verifier_value";
|
|
28
28
|
export declare const mockedState = "state_value";
|
|
29
|
+
export declare const mockedUserHint = "johndoe@example.com";
|
|
29
30
|
export declare const mockedSignInUri: string;
|
|
30
31
|
export declare const mockedSignInUriWithLoginPrompt: string;
|
|
31
32
|
export declare const mockedSignUpUri: string;
|
|
33
|
+
export declare const mockedSignInUriWithLoginHint: string;
|
|
32
34
|
export declare const accessToken = "access_token_value";
|
|
33
35
|
export declare const refreshToken = "new_refresh_token_value";
|
|
34
36
|
export declare const idToken = "id_token_value";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/client",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "packages/client"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@logto/js": "^4.0.
|
|
32
|
+
"@logto/js": "^4.0.1",
|
|
33
33
|
"@silverhand/essentials": "^2.8.7",
|
|
34
34
|
"camelcase-keys": "^7.0.1",
|
|
35
35
|
"jose": "^5.2.2"
|