@sendoracloud/sdk-react-native 0.18.4 → 0.18.5
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/index.cjs +26 -3
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +26 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -654,6 +654,29 @@ var Auth = class {
|
|
|
654
654
|
}
|
|
655
655
|
return { authorizationUrl: parsed.data.authorizationUrl };
|
|
656
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Kick off a SAML 2.0 SSO flow. Mirrors `startSso` for SAML —
|
|
659
|
+
* backend POST `/auth-service/sso/saml/start` returns the IdP
|
|
660
|
+
* AuthnRequest URL. Caller opens it with
|
|
661
|
+
* ASWebAuthenticationSession (iOS) / Custom Tabs (Android) /
|
|
662
|
+
* Linking, captures the callback URL via the standard
|
|
663
|
+
* `Linking.addEventListener` flow, then passes the captured URL to
|
|
664
|
+
* `consumeSsoFragment(url)`. consumeSsoFragment handles both OIDC
|
|
665
|
+
* and SAML fragments transparently.
|
|
666
|
+
*/
|
|
667
|
+
async startSaml(returnTo) {
|
|
668
|
+
const res = await post(
|
|
669
|
+
{ apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
|
|
670
|
+
"/api/v1/auth-service/sso/saml/start",
|
|
671
|
+
{ returnTo }
|
|
672
|
+
);
|
|
673
|
+
if (!res || !res.ok) throw new AuthError("SAML_START_FAILED", `HTTP ${res?.status ?? "network"}`);
|
|
674
|
+
const parsed = await res.json();
|
|
675
|
+
if (!parsed.success || !parsed.data?.authorizationUrl) {
|
|
676
|
+
throw new AuthError("SAML_START_FAILED", "Missing authorizationUrl");
|
|
677
|
+
}
|
|
678
|
+
return { authorizationUrl: parsed.data.authorizationUrl };
|
|
679
|
+
}
|
|
657
680
|
/**
|
|
658
681
|
* Consume an OIDC callback URL captured via React Native's
|
|
659
682
|
* `Linking.addEventListener('url', ...)`. Reads the fragment for
|
|
@@ -666,10 +689,10 @@ var Auth = class {
|
|
|
666
689
|
const hashIdx = callbackUrl.indexOf("#");
|
|
667
690
|
const fragment = hashIdx >= 0 ? callbackUrl.slice(hashIdx + 1) : "";
|
|
668
691
|
const params = new URLSearchParams(fragment);
|
|
669
|
-
const err = params.get("sendora_oidc_error");
|
|
692
|
+
const err = params.get("sendora_oidc_error") ?? params.get("sendora_saml_error");
|
|
670
693
|
if (err) throw new AuthError("SSO_FAILED", decodeURIComponent(err));
|
|
671
|
-
const refresh = params.get("sendora_oidc_token");
|
|
672
|
-
if (!refresh) throw new AuthError("SSO_NO_TOKEN", "Callback URL has no
|
|
694
|
+
const refresh = params.get("sendora_oidc_token") ?? params.get("sendora_saml_token");
|
|
695
|
+
if (!refresh) throw new AuthError("SSO_NO_TOKEN", "Callback URL has no SSO token");
|
|
673
696
|
const res = await post(
|
|
674
697
|
{ apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
|
|
675
698
|
"/api/v1/auth-service/token/refresh",
|
package/dist/index.d.cts
CHANGED
|
@@ -268,6 +268,19 @@ declare class Auth {
|
|
|
268
268
|
startSso(returnTo: string): Promise<{
|
|
269
269
|
authorizationUrl: string;
|
|
270
270
|
}>;
|
|
271
|
+
/**
|
|
272
|
+
* Kick off a SAML 2.0 SSO flow. Mirrors `startSso` for SAML —
|
|
273
|
+
* backend POST `/auth-service/sso/saml/start` returns the IdP
|
|
274
|
+
* AuthnRequest URL. Caller opens it with
|
|
275
|
+
* ASWebAuthenticationSession (iOS) / Custom Tabs (Android) /
|
|
276
|
+
* Linking, captures the callback URL via the standard
|
|
277
|
+
* `Linking.addEventListener` flow, then passes the captured URL to
|
|
278
|
+
* `consumeSsoFragment(url)`. consumeSsoFragment handles both OIDC
|
|
279
|
+
* and SAML fragments transparently.
|
|
280
|
+
*/
|
|
281
|
+
startSaml(returnTo: string): Promise<{
|
|
282
|
+
authorizationUrl: string;
|
|
283
|
+
}>;
|
|
271
284
|
/**
|
|
272
285
|
* Consume an OIDC callback URL captured via React Native's
|
|
273
286
|
* `Linking.addEventListener('url', ...)`. Reads the fragment for
|
package/dist/index.d.ts
CHANGED
|
@@ -268,6 +268,19 @@ declare class Auth {
|
|
|
268
268
|
startSso(returnTo: string): Promise<{
|
|
269
269
|
authorizationUrl: string;
|
|
270
270
|
}>;
|
|
271
|
+
/**
|
|
272
|
+
* Kick off a SAML 2.0 SSO flow. Mirrors `startSso` for SAML —
|
|
273
|
+
* backend POST `/auth-service/sso/saml/start` returns the IdP
|
|
274
|
+
* AuthnRequest URL. Caller opens it with
|
|
275
|
+
* ASWebAuthenticationSession (iOS) / Custom Tabs (Android) /
|
|
276
|
+
* Linking, captures the callback URL via the standard
|
|
277
|
+
* `Linking.addEventListener` flow, then passes the captured URL to
|
|
278
|
+
* `consumeSsoFragment(url)`. consumeSsoFragment handles both OIDC
|
|
279
|
+
* and SAML fragments transparently.
|
|
280
|
+
*/
|
|
281
|
+
startSaml(returnTo: string): Promise<{
|
|
282
|
+
authorizationUrl: string;
|
|
283
|
+
}>;
|
|
271
284
|
/**
|
|
272
285
|
* Consume an OIDC callback URL captured via React Native's
|
|
273
286
|
* `Linking.addEventListener('url', ...)`. Reads the fragment for
|
package/dist/index.js
CHANGED
|
@@ -611,6 +611,29 @@ var Auth = class {
|
|
|
611
611
|
}
|
|
612
612
|
return { authorizationUrl: parsed.data.authorizationUrl };
|
|
613
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Kick off a SAML 2.0 SSO flow. Mirrors `startSso` for SAML —
|
|
616
|
+
* backend POST `/auth-service/sso/saml/start` returns the IdP
|
|
617
|
+
* AuthnRequest URL. Caller opens it with
|
|
618
|
+
* ASWebAuthenticationSession (iOS) / Custom Tabs (Android) /
|
|
619
|
+
* Linking, captures the callback URL via the standard
|
|
620
|
+
* `Linking.addEventListener` flow, then passes the captured URL to
|
|
621
|
+
* `consumeSsoFragment(url)`. consumeSsoFragment handles both OIDC
|
|
622
|
+
* and SAML fragments transparently.
|
|
623
|
+
*/
|
|
624
|
+
async startSaml(returnTo) {
|
|
625
|
+
const res = await post(
|
|
626
|
+
{ apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
|
|
627
|
+
"/api/v1/auth-service/sso/saml/start",
|
|
628
|
+
{ returnTo }
|
|
629
|
+
);
|
|
630
|
+
if (!res || !res.ok) throw new AuthError("SAML_START_FAILED", `HTTP ${res?.status ?? "network"}`);
|
|
631
|
+
const parsed = await res.json();
|
|
632
|
+
if (!parsed.success || !parsed.data?.authorizationUrl) {
|
|
633
|
+
throw new AuthError("SAML_START_FAILED", "Missing authorizationUrl");
|
|
634
|
+
}
|
|
635
|
+
return { authorizationUrl: parsed.data.authorizationUrl };
|
|
636
|
+
}
|
|
614
637
|
/**
|
|
615
638
|
* Consume an OIDC callback URL captured via React Native's
|
|
616
639
|
* `Linking.addEventListener('url', ...)`. Reads the fragment for
|
|
@@ -623,10 +646,10 @@ var Auth = class {
|
|
|
623
646
|
const hashIdx = callbackUrl.indexOf("#");
|
|
624
647
|
const fragment = hashIdx >= 0 ? callbackUrl.slice(hashIdx + 1) : "";
|
|
625
648
|
const params = new URLSearchParams(fragment);
|
|
626
|
-
const err = params.get("sendora_oidc_error");
|
|
649
|
+
const err = params.get("sendora_oidc_error") ?? params.get("sendora_saml_error");
|
|
627
650
|
if (err) throw new AuthError("SSO_FAILED", decodeURIComponent(err));
|
|
628
|
-
const refresh = params.get("sendora_oidc_token");
|
|
629
|
-
if (!refresh) throw new AuthError("SSO_NO_TOKEN", "Callback URL has no
|
|
651
|
+
const refresh = params.get("sendora_oidc_token") ?? params.get("sendora_saml_token");
|
|
652
|
+
if (!refresh) throw new AuthError("SSO_NO_TOKEN", "Callback URL has no SSO token");
|
|
630
653
|
const res = await post(
|
|
631
654
|
{ apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
|
|
632
655
|
"/api/v1/auth-service/token/refresh",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth, deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push token registration requires a Dev Client (EAS Build or `npx expo prebuild`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|