FormidableLabs / FormidableLabs/react-native-app-auth
Multiple calls to authorize() cause iOS to crash
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 473
- PR merge metrics
- No merged PRs in 30d
Description
## Issue
iOS app crashes if a call to `authorize()` has not yet been completed before another call to `authorize()` is made.
**NOTE:** This works perfectly on Android. Android *appears* to cancel any pre-existing `authorize()` calls when a new call is made.
### Use case
We have 2 auth flows implemented as 2 different policies in Azure B2C:
1. Sign Up with invite link sent by email, B2C_1A_SU_INVITE policy.
The invite link is a universal link that, when clicked, triggers the app to call `authorize()` using the B2C_1A_SU_INVITE url as the issuer and initiates our custom Sign Up flow in B2C.
2. Sign In, B2C_1A_SI_ONLY policy.
A user clicks on a button to initiate Sign In and the app calls `authorize()` using the B2C_1A_SI_ONLY url as the issuer and initiates a Sign In flow in B2C.
A user can begin to sign in (1st call to `authorize()`) and the browser appears with the B2C hosted page. If the user switches to their email and clicks on the Sign Up invite link while the Sign In browser is still active, the app crashes as soon as it attempts to display the Sign Up page (2nd call to `authorize()`).
Our config is standard:
```
const config = {
// USER_FLOW_NAME can be either B2C_1A_SI_ONLY or B2C_1A_SU_INVITE
issuer: 'https://.b2clogin.com/.onmicrosoft.com//v2.0',
clientId: '',
redirectUrl: 'com.myapp://redirect/url/', // the redirectUrl must end with a slash
scopes: ['openid', 'offline_access']
iosPrefersEphemeralSession: true
};
```
---
## Environment
* **Your Identity Provider**: `Azure AD B2C`
* **Platform that you're experiencing the issue on**: `iOS only`
* **Are you using Expo?** No
* **Version?** 7.0.0-rc2 (RN 0.70.4)
Contributor guide
Assessment
This issue has not been assessed yet.