@oxyhq/core 1.11.8 → 1.11.9
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/mixins/OxyServices.fedcm.js +4 -11
- package/dist/cjs/mixins/OxyServices.popup.js +5 -9
- package/dist/cjs/mixins/OxyServices.redirect.js +1 -5
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/mixins/OxyServices.fedcm.js +4 -11
- package/dist/esm/mixins/OxyServices.popup.js +5 -9
- package/dist/esm/mixins/OxyServices.redirect.js +1 -5
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/mixins/OxyServices.fedcm.d.ts +0 -3
- package/dist/types/mixins/OxyServices.popup.d.ts +0 -2
- package/dist/types/mixins/OxyServices.redirect.d.ts +0 -2
- package/package.json +1 -1
- package/src/mixins/OxyServices.fedcm.ts +4 -12
- package/src/mixins/OxyServices.popup.ts +5 -10
- package/src/mixins/OxyServices.redirect.ts +1 -6
|
@@ -34,12 +34,6 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
34
34
|
constructor(...args) {
|
|
35
35
|
super(...args);
|
|
36
36
|
}
|
|
37
|
-
/** Resolved FedCM config URL: derived from config.authWebUrl or uses the static default */
|
|
38
|
-
get fedcmConfigUrl() {
|
|
39
|
-
return this.config.authWebUrl
|
|
40
|
-
? `${this.config.authWebUrl}/fedcm.json`
|
|
41
|
-
: this.constructor.DEFAULT_CONFIG_URL;
|
|
42
|
-
}
|
|
43
37
|
/**
|
|
44
38
|
* Check if FedCM is supported in the current browser
|
|
45
39
|
*/
|
|
@@ -91,7 +85,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
91
85
|
// Request credential from browser's native identity flow
|
|
92
86
|
// mode: 'button' signals this is a user-gesture-initiated flow (Chrome 125+)
|
|
93
87
|
const credential = await this.requestIdentityCredential({
|
|
94
|
-
configURL: this.
|
|
88
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : this.constructor.DEFAULT_CONFIG_URL),
|
|
95
89
|
clientId,
|
|
96
90
|
nonce,
|
|
97
91
|
context: options.context,
|
|
@@ -181,7 +175,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
181
175
|
const nonce = this.generateNonce();
|
|
182
176
|
debug.log('Silent SSO: Attempting silent mediation...', loginHint ? `(hint: ${loginHint})` : '');
|
|
183
177
|
credential = await this.requestIdentityCredential({
|
|
184
|
-
configURL: this.
|
|
178
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : this.constructor.DEFAULT_CONFIG_URL),
|
|
185
179
|
clientId,
|
|
186
180
|
nonce,
|
|
187
181
|
loginHint,
|
|
@@ -395,7 +389,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
395
389
|
if ('IdentityCredential' in window && 'disconnect' in window.IdentityCredential) {
|
|
396
390
|
const clientId = this.getClientId();
|
|
397
391
|
await window.IdentityCredential.disconnect({
|
|
398
|
-
configURL: this.
|
|
392
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : this.constructor.DEFAULT_CONFIG_URL),
|
|
399
393
|
clientId,
|
|
400
394
|
accountHint: accountHint || '*',
|
|
401
395
|
});
|
|
@@ -414,7 +408,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
414
408
|
getFedCMConfig() {
|
|
415
409
|
return {
|
|
416
410
|
enabled: this.isFedCMSupported(),
|
|
417
|
-
configURL: this.
|
|
411
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : this.constructor.DEFAULT_CONFIG_URL),
|
|
418
412
|
clientId: this.getClientId(),
|
|
419
413
|
};
|
|
420
414
|
}
|
|
@@ -479,7 +473,6 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
479
473
|
}
|
|
480
474
|
}
|
|
481
475
|
},
|
|
482
|
-
_a.DEFAULT_AUTH_URL = 'https://auth.oxy.so',
|
|
483
476
|
_a.DEFAULT_CONFIG_URL = 'https://auth.oxy.so/fedcm.json',
|
|
484
477
|
_a.FEDCM_TIMEOUT = 15000 // 15 seconds for interactive
|
|
485
478
|
,
|
|
@@ -29,10 +29,6 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
29
29
|
constructor(...args) {
|
|
30
30
|
super(...args);
|
|
31
31
|
}
|
|
32
|
-
/** Resolved auth URL: config.authWebUrl takes precedence over the static default */
|
|
33
|
-
get authUrl() {
|
|
34
|
-
return this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL;
|
|
35
|
-
}
|
|
36
32
|
/**
|
|
37
33
|
* Sign in using popup window
|
|
38
34
|
*
|
|
@@ -75,7 +71,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
75
71
|
state,
|
|
76
72
|
nonce,
|
|
77
73
|
clientId: window.location.origin,
|
|
78
|
-
redirectUri: `${this.
|
|
74
|
+
redirectUri: `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/callback`,
|
|
79
75
|
});
|
|
80
76
|
const popup = this.openCenteredPopup(authUrl, 'Oxy Sign In', width, height);
|
|
81
77
|
if (!popup) {
|
|
@@ -163,7 +159,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
163
159
|
iframe.style.width = '0';
|
|
164
160
|
iframe.style.height = '0';
|
|
165
161
|
iframe.style.border = 'none';
|
|
166
|
-
const silentUrl = `${this.
|
|
162
|
+
const silentUrl = `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
|
|
167
163
|
iframe.src = silentUrl;
|
|
168
164
|
document.body.appendChild(iframe);
|
|
169
165
|
try {
|
|
@@ -214,7 +210,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
214
210
|
reject(new OxyAuthenticationError('Authentication timeout'));
|
|
215
211
|
}, timeout);
|
|
216
212
|
const messageHandler = (event) => {
|
|
217
|
-
const authUrl = this.
|
|
213
|
+
const authUrl = (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL);
|
|
218
214
|
// Log all messages for debugging
|
|
219
215
|
if (event.data && typeof event.data === 'object' && event.data.type) {
|
|
220
216
|
debug.log('Message received:', {
|
|
@@ -286,7 +282,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
286
282
|
}, timeout);
|
|
287
283
|
const messageHandler = (event) => {
|
|
288
284
|
// Verify origin
|
|
289
|
-
if (event.origin !== this.
|
|
285
|
+
if (event.origin !== (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)) {
|
|
290
286
|
return;
|
|
291
287
|
}
|
|
292
288
|
const { type, session } = event.data;
|
|
@@ -309,7 +305,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
309
305
|
* @private
|
|
310
306
|
*/
|
|
311
307
|
buildAuthUrl(params) {
|
|
312
|
-
const url = new URL(`${this.
|
|
308
|
+
const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
313
309
|
url.searchParams.set('response_type', 'token');
|
|
314
310
|
url.searchParams.set('client_id', params.clientId);
|
|
315
311
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
@@ -29,10 +29,6 @@ export function OxyServicesRedirectAuthMixin(Base) {
|
|
|
29
29
|
constructor(...args) {
|
|
30
30
|
super(...args);
|
|
31
31
|
}
|
|
32
|
-
/** Resolved auth URL: config.authWebUrl takes precedence over the static default */
|
|
33
|
-
get authUrl() {
|
|
34
|
-
return this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL;
|
|
35
|
-
}
|
|
36
32
|
/**
|
|
37
33
|
* Sign in using full page redirect
|
|
38
34
|
*
|
|
@@ -228,7 +224,7 @@ export function OxyServicesRedirectAuthMixin(Base) {
|
|
|
228
224
|
* @private
|
|
229
225
|
*/
|
|
230
226
|
buildAuthUrl(params) {
|
|
231
|
-
const url = new URL(`${this.
|
|
227
|
+
const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
232
228
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
233
229
|
url.searchParams.set('state', params.state);
|
|
234
230
|
url.searchParams.set('nonce', params.nonce);
|