@logto/js 4.0.0 → 4.0.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/consts/index.cjs +1 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/core/sign-in.cjs +4 -1
- package/lib/core/sign-in.d.ts +2 -1
- package/lib/core/sign-in.js +4 -1
- package/package.json +1 -1
package/lib/consts/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ exports.QueryKey = void 0;
|
|
|
22
22
|
QueryKey["GrantType"] = "grant_type";
|
|
23
23
|
QueryKey["IdToken"] = "id_token";
|
|
24
24
|
QueryKey["IdTokenHint"] = "id_token_hint";
|
|
25
|
+
QueryKey["LoginHint"] = "login_hint";
|
|
25
26
|
QueryKey["PostLogoutRedirectUri"] = "post_logout_redirect_uri";
|
|
26
27
|
QueryKey["Prompt"] = "prompt";
|
|
27
28
|
QueryKey["RedirectUri"] = "redirect_uri";
|
package/lib/consts/index.d.ts
CHANGED
package/lib/consts/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var QueryKey;
|
|
|
20
20
|
QueryKey["GrantType"] = "grant_type";
|
|
21
21
|
QueryKey["IdToken"] = "id_token";
|
|
22
22
|
QueryKey["IdTokenHint"] = "id_token_hint";
|
|
23
|
+
QueryKey["LoginHint"] = "login_hint";
|
|
23
24
|
QueryKey["PostLogoutRedirectUri"] = "post_logout_redirect_uri";
|
|
24
25
|
QueryKey["Prompt"] = "prompt";
|
|
25
26
|
QueryKey["RedirectUri"] = "redirect_uri";
|
package/lib/core/sign-in.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const buildPrompt = (prompt) => {
|
|
|
11
11
|
}
|
|
12
12
|
return prompt ?? index.Prompt.Consent;
|
|
13
13
|
};
|
|
14
|
-
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, interactionMode, }) => {
|
|
14
|
+
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, interactionMode, loginHint, }) => {
|
|
15
15
|
const urlSearchParameters = new URLSearchParams({
|
|
16
16
|
[index.QueryKey.ClientId]: clientId,
|
|
17
17
|
[index.QueryKey.RedirectUri]: redirectUri,
|
|
@@ -22,6 +22,9 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
22
22
|
[index.QueryKey.Prompt]: buildPrompt(prompt),
|
|
23
23
|
[index.QueryKey.Scope]: scopes.withDefaultScopes(scopes$1),
|
|
24
24
|
});
|
|
25
|
+
if (loginHint) {
|
|
26
|
+
urlSearchParameters.append(index.QueryKey.LoginHint, loginHint);
|
|
27
|
+
}
|
|
25
28
|
for (const resource of resources ?? []) {
|
|
26
29
|
urlSearchParameters.append(index.QueryKey.Resource, resource);
|
|
27
30
|
}
|
package/lib/core/sign-in.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export type SignInUriParameters = {
|
|
|
10
10
|
resources?: string[];
|
|
11
11
|
prompt?: Prompt | Prompt[];
|
|
12
12
|
interactionMode?: InteractionMode;
|
|
13
|
+
loginHint?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }: SignInUriParameters) => string;
|
|
15
|
+
export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, loginHint, }: SignInUriParameters) => string;
|
package/lib/core/sign-in.js
CHANGED
|
@@ -9,7 +9,7 @@ const buildPrompt = (prompt) => {
|
|
|
9
9
|
}
|
|
10
10
|
return prompt ?? Prompt.Consent;
|
|
11
11
|
};
|
|
12
|
-
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }) => {
|
|
12
|
+
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, loginHint, }) => {
|
|
13
13
|
const urlSearchParameters = new URLSearchParams({
|
|
14
14
|
[QueryKey.ClientId]: clientId,
|
|
15
15
|
[QueryKey.RedirectUri]: redirectUri,
|
|
@@ -20,6 +20,9 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
20
20
|
[QueryKey.Prompt]: buildPrompt(prompt),
|
|
21
21
|
[QueryKey.Scope]: withDefaultScopes(scopes),
|
|
22
22
|
});
|
|
23
|
+
if (loginHint) {
|
|
24
|
+
urlSearchParameters.append(QueryKey.LoginHint, loginHint);
|
|
25
|
+
}
|
|
23
26
|
for (const resource of resources ?? []) {
|
|
24
27
|
urlSearchParameters.append(QueryKey.Resource, resource);
|
|
25
28
|
}
|