FormidableLabs / FormidableLabs/react-native-app-auth
App crashes on Android when trying to authorize or redirect to provider login screen: state cannot be null or empty
- Langage dominant
- Java
- Étoiles
- 2.3k
- Forks
- 473
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## Issue
Crash when logging into the application the first time, the other times it works normally. When the token expires and logout is called, the app also gives an error.
> Note: Note: We are using react-native-config for environment variables and login with WSO2
The following error is returned:
```
java.lang.RuntimeException: Unable to resume activity {com.apptort/net.openid.appauth.AuthorizationManagementActivity}: java.lang.NullPointerException: state cannot be null or empty
java.lang.RuntimeException: Unable to resume activity {com.apptort/net.openid.appauth.AuthorizationManagementActivity}: java.lang.NullPointerException: state cannot be null or empty
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4975)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5008)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8252)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.NullPointerException: state cannot be null or empty
at net.openid.appauth.w.f(Unknown Source:9)
at net.openid.appauth.w.d(Unknown Source:0)
at net.openid.appauth.s$b.d(Unknown Source:2)
at net.openid.appauth.s$b.b(Unknown Source:6)
at net.openid.appauth.g.b(Unknown Source:31)
at net.openid.appauth.AuthorizationManagementActivity.e(Unknown Source:23)
at net.openid.appauth.AuthorizationManagementActivity.h(Unknown Source:8)
at net.openid.appauth.AuthorizationManagementActivity.onResume(Unknown Source:26)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1565)
at android.app.Activity.performResume(Activity.java:8668)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4965)
... 13 more
```
### AndroidManifest.xml
```
```
### .env
```
ISSUER = "https://url/oauth2/oidcdiscovery"
CLIENTID = "_secret_"
CLIENTSECRET = "_secret_"
REDIRECTURL = "com.apptort.auth://TortList"
POSTLOGOUTREDIRECTURL = "com.apptort.auth://Welcome"
```
### config
```
const config = {
issuer: Config.ISSUER,
clientId: Config.CLIENTID,
clientSecret: Config.CLIENTSECRET,
redirectUrl: Config.REDIRECTURL,
scopes: ['openid', 'profile'],
dangerouslyAllowInsecureHttpRequests: true,
};
```
---
## Environment
* **Your Identity Provider**: `IdentityServer 4`
* **Platform that you're experiencing the issue on**: `Android`
* **Are you using Expo?:** `No`
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par comparer les activités de redirection de AndroidManifest.xml et les URL de redirection de .env avec l’objet de configuration. Suivez ensuite le flux d’autorisation et de déconnexion sur Android, en vous concentrant sur la première connexion et les cas d’expiration du token. Reproduisez le crash et confirmez que les deux flux s’achèvent sans l’erreur AppAuth « state cannot be null or empty ».
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, react-native
- Domaine
- authentication, mobile
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100