Skip to content

Commit 94f7c87

Browse files
fant0mexbryceknz
andauthored
Fix/dupe state (#974)
Co-authored-by: bryceknz <25199713+bryceknz@users.noreply.github.com>
1 parent 1f17e8b commit 94f7c87

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

.changeset/cuddly-rules-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-app-auth': patch
3+
---
4+
5+
Remove duplicate iOS auth `state` and `nonce` parameters.

packages/react-native-app-auth/ios/RNAppAuth.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
338338
NSString *codeVerifier = usePKCE ? [[self class] generateCodeVerifier] : nil;
339339
NSString *codeChallenge = usePKCE ? [[self class] codeChallengeS256ForVerifier:codeVerifier] : nil;
340340
NSString *nonce = useNonce ? additionalParameters[@"nonce"]? additionalParameters[@"nonce"]: [[self class] generateState] : nil ;
341+
342+
NSMutableDictionary* mutableDict = [additionalParameters mutableCopy];
343+
[mutableDict removeObjectForKey:@"state"];
344+
[mutableDict removeObjectForKey:@"nonce"];
341345

342346
// builds authentication request
343347
OIDAuthorizationRequest *request =
@@ -353,7 +357,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
353357
codeVerifier:codeVerifier
354358
codeChallenge:codeChallenge
355359
codeChallengeMethod: usePKCE ? OIDOAuthorizationRequestCodeChallengeMethodS256 : nil
356-
additionalParameters:additionalParameters];
360+
additionalParameters:[mutableDict copy]];
357361

358362
// performs authentication request
359363
id<UIApplicationDelegate, RNAppAuthAuthorizationFlowManager> appDelegate = (id<UIApplicationDelegate, RNAppAuthAuthorizationFlowManager>)[UIApplication sharedApplication].delegate;

0 commit comments

Comments
 (0)