Skip to content

Commit

Permalink
Changed ActivityResult requestCode to be a value different than 0 (#641)
Browse files Browse the repository at this point in the history
Changed ActivityResult requestCode to be a value different than 0, as this can cause some unforeseen issues.
  • Loading branch information
KrasimirGatevMentorMate authored Jun 27, 2021
1 parent 7f46adc commit 51cfc6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions android/src/main/java/com/rnappauth/RNAppAuthModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public void onFetchConfigurationCompleted(
*/
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
if (requestCode == 0) {
if (requestCode == 52) {
if (data == null) {
if (promise != null) {
promise.reject("authentication_error", "Data intent is null" );
Expand Down Expand Up @@ -592,10 +592,10 @@ private void authorizeWithConfiguration(
AuthorizationService authService = new AuthorizationService(context, appAuthConfiguration);
Intent authIntent = authService.getAuthorizationRequestIntent(authRequest);

currentActivity.startActivityForResult(authIntent, 0);
currentActivity.startActivityForResult(authIntent, 52);
} else {
AuthorizationService authService = new AuthorizationService(currentActivity, appAuthConfiguration);
PendingIntent pendingIntent = currentActivity.createPendingResult(0, new Intent(), 0);
PendingIntent pendingIntent = currentActivity.createPendingResult(52, new Intent(), 0);

authService.performAuthorizationRequest(authRequest, pendingIntent);
}
Expand Down

0 comments on commit 51cfc6e

Please sign in to comment.