@logto/js 4.0.0-alpha.0 → 4.0.0-alpha.2
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/revoke.cjs +1 -1
- package/lib/core/revoke.js +1 -1
- package/lib/core/sign-in.cjs +7 -1
- package/lib/core/sign-in.d.ts +1 -1
- package/lib/core/sign-in.js +7 -1
- package/package.json +1 -1
package/lib/consts/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ exports.QueryKey = void 0;
|
|
|
39
39
|
/** The prompt parameter to be used for the authorization request. */
|
|
40
40
|
exports.Prompt = void 0;
|
|
41
41
|
(function (Prompt) {
|
|
42
|
+
Prompt["None"] = "none";
|
|
42
43
|
/**
|
|
43
44
|
* The Authorization Server MUST prompt the End-User for consent
|
|
44
45
|
* before returning information to the Client.
|
package/lib/consts/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare enum QueryKey {
|
|
|
34
34
|
}
|
|
35
35
|
/** The prompt parameter to be used for the authorization request. */
|
|
36
36
|
export declare enum Prompt {
|
|
37
|
+
None = "none",
|
|
37
38
|
/**
|
|
38
39
|
* The Authorization Server MUST prompt the End-User for consent
|
|
39
40
|
* before returning information to the Client.
|
package/lib/consts/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var QueryKey;
|
|
|
37
37
|
/** The prompt parameter to be used for the authorization request. */
|
|
38
38
|
var Prompt;
|
|
39
39
|
(function (Prompt) {
|
|
40
|
+
Prompt["None"] = "none";
|
|
40
41
|
/**
|
|
41
42
|
* The Authorization Server MUST prompt the End-User for consent
|
|
42
43
|
* before returning information to the Client.
|
package/lib/core/revoke.cjs
CHANGED
package/lib/core/revoke.js
CHANGED
package/lib/core/sign-in.cjs
CHANGED
|
@@ -5,6 +5,12 @@ var scopes = require('../utils/scopes.cjs');
|
|
|
5
5
|
|
|
6
6
|
const codeChallengeMethod = 'S256';
|
|
7
7
|
const responseType = 'code';
|
|
8
|
+
const buildPrompt = (prompt) => {
|
|
9
|
+
if (Array.isArray(prompt)) {
|
|
10
|
+
return prompt.join(' ');
|
|
11
|
+
}
|
|
12
|
+
return prompt ?? index.Prompt.Consent;
|
|
13
|
+
};
|
|
8
14
|
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, interactionMode, }) => {
|
|
9
15
|
const urlSearchParameters = new URLSearchParams({
|
|
10
16
|
[index.QueryKey.ClientId]: clientId,
|
|
@@ -13,7 +19,7 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
13
19
|
[index.QueryKey.CodeChallengeMethod]: codeChallengeMethod,
|
|
14
20
|
[index.QueryKey.State]: state,
|
|
15
21
|
[index.QueryKey.ResponseType]: responseType,
|
|
16
|
-
[index.QueryKey.Prompt]: prompt
|
|
22
|
+
[index.QueryKey.Prompt]: buildPrompt(prompt),
|
|
17
23
|
[index.QueryKey.Scope]: scopes.withDefaultScopes(scopes$1),
|
|
18
24
|
});
|
|
19
25
|
for (const resource of resources ?? []) {
|
package/lib/core/sign-in.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type SignInUriParameters = {
|
|
|
8
8
|
state: string;
|
|
9
9
|
scopes?: string[];
|
|
10
10
|
resources?: string[];
|
|
11
|
-
prompt?: Prompt;
|
|
11
|
+
prompt?: Prompt | Prompt[];
|
|
12
12
|
interactionMode?: InteractionMode;
|
|
13
13
|
};
|
|
14
14
|
export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }: SignInUriParameters) => string;
|
package/lib/core/sign-in.js
CHANGED
|
@@ -3,6 +3,12 @@ import { withDefaultScopes } from '../utils/scopes.js';
|
|
|
3
3
|
|
|
4
4
|
const codeChallengeMethod = 'S256';
|
|
5
5
|
const responseType = 'code';
|
|
6
|
+
const buildPrompt = (prompt) => {
|
|
7
|
+
if (Array.isArray(prompt)) {
|
|
8
|
+
return prompt.join(' ');
|
|
9
|
+
}
|
|
10
|
+
return prompt ?? Prompt.Consent;
|
|
11
|
+
};
|
|
6
12
|
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, interactionMode, }) => {
|
|
7
13
|
const urlSearchParameters = new URLSearchParams({
|
|
8
14
|
[QueryKey.ClientId]: clientId,
|
|
@@ -11,7 +17,7 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
11
17
|
[QueryKey.CodeChallengeMethod]: codeChallengeMethod,
|
|
12
18
|
[QueryKey.State]: state,
|
|
13
19
|
[QueryKey.ResponseType]: responseType,
|
|
14
|
-
[QueryKey.Prompt]: prompt
|
|
20
|
+
[QueryKey.Prompt]: buildPrompt(prompt),
|
|
15
21
|
[QueryKey.Scope]: withDefaultScopes(scopes),
|
|
16
22
|
});
|
|
17
23
|
for (const resource of resources ?? []) {
|