@alien_org/sso-sdk-core 1.0.10 → 1.0.12
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/dist/client.js +7 -6
- package/dist/schema.d.ts +0 -7
- package/dist/schema.js +0 -6
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthorizeResponseSchema, ExchangeCodeRequestSchema, ExchangeCodeResponseSchema,
|
|
1
|
+
import { AuthorizeResponseSchema, ExchangeCodeRequestSchema, ExchangeCodeResponseSchema, AuthorizeRequestSchema, PollRequestSchema, PollResponseSchema, TokenInfoSchema, VerifyTokenRequestSchema, VerifyTokenResponseSchema, } from './schema';
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
3
|
import base64url from 'base64url';
|
|
4
4
|
import CryptoJS from 'crypto-js';
|
|
@@ -44,11 +44,12 @@ export class AlienSsoSdkClient {
|
|
|
44
44
|
const codeVerifier = this.generateCodeVerifier();
|
|
45
45
|
const codeChallenge = await this.generateCodeChallenge(codeVerifier);
|
|
46
46
|
sessionStorage.setItem(STORAGE_KEY + 'code_verifier', codeVerifier);
|
|
47
|
-
const authorizeUrl = `${this.config.ssoBaseUrl}/authorize`;
|
|
47
|
+
const authorizeUrl = `${this.config.ssoBaseUrl}/sso/authorize`;
|
|
48
48
|
const authorizePayload = {
|
|
49
49
|
code_challenge: codeChallenge,
|
|
50
|
+
code_challenge_method: 'S256'
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
AuthorizeRequestSchema.parse(authorizePayload);
|
|
52
53
|
const response = await fetch(authorizeUrl, {
|
|
53
54
|
method: 'POST',
|
|
54
55
|
headers: {
|
|
@@ -66,7 +67,7 @@ export class AlienSsoSdkClient {
|
|
|
66
67
|
};
|
|
67
68
|
PollRequestSchema.parse(pollPayload);
|
|
68
69
|
while (true) {
|
|
69
|
-
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/poll'), {
|
|
70
|
+
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/sso/poll'), {
|
|
70
71
|
method: 'POST',
|
|
71
72
|
headers: {
|
|
72
73
|
'Content-Type': 'application/json',
|
|
@@ -100,7 +101,7 @@ export class AlienSsoSdkClient {
|
|
|
100
101
|
code_verifier: codeVerifier,
|
|
101
102
|
};
|
|
102
103
|
ExchangeCodeRequestSchema.parse(exchangeCodePayload);
|
|
103
|
-
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/access_token/exchange'), {
|
|
104
|
+
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/sso/access_token/exchange'), {
|
|
104
105
|
method: 'POST',
|
|
105
106
|
headers: {
|
|
106
107
|
'Content-Type': 'application/json',
|
|
@@ -130,7 +131,7 @@ export class AlienSsoSdkClient {
|
|
|
130
131
|
access_token,
|
|
131
132
|
};
|
|
132
133
|
VerifyTokenRequestSchema.parse(verifyTokenPayload);
|
|
133
|
-
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/access_token/verify'), {
|
|
134
|
+
const response = await fetch(joinUrl(this.config.ssoBaseUrl, '/sso/access_token/verify'), {
|
|
134
135
|
method: 'POST',
|
|
135
136
|
headers: {
|
|
136
137
|
'Content-Type': 'application/json',
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod/v4-mini';
|
|
2
|
-
/**
|
|
3
|
-
* Internal Authorize request/response schema to server SDK
|
|
4
|
-
*/
|
|
5
|
-
export declare const InternalAuthorizeRequestSchema: z.ZodMiniObject<{
|
|
6
|
-
code_challenge: z.ZodMiniString<string>;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
export type InternalAuthorizeRequest = z.infer<typeof InternalAuthorizeRequestSchema>;
|
|
9
2
|
/**
|
|
10
3
|
* Authorize request/response schema
|
|
11
4
|
*/
|
package/dist/schema.js
CHANGED