@@ -36,15 +36,15 @@ - (dispatch_queue_t)methodQueue
3636 additionalParameters: additionalParameters
3737 resolve: resolve
3838 reject: reject];
39-
39+
4040 } else {
4141 [OIDAuthorizationService discoverServiceConfigurationForIssuer: [NSURL URLWithString: issuer]
4242 completion: ^(OIDServiceConfiguration *_Nullable configuration, NSError *_Nullable error) {
4343 if (!configuration) {
4444 reject (@" RNAppAuth Error" , [error localizedDescription ], error);
4545 return ;
4646 }
47-
47+
4848 [self authorizeWithConfiguration: configuration
4949 redirectUrl: redirectUrl
5050 clientId: clientId
@@ -81,7 +81,7 @@ - (dispatch_queue_t)methodQueue
8181 additionalParameters: additionalParameters
8282 resolve: resolve
8383 reject: reject];
84-
84+
8585 } else {
8686 // otherwise hit up the discovery endpoint
8787 [OIDAuthorizationService discoverServiceConfigurationForIssuer: [NSURL URLWithString: issuer]
@@ -111,13 +111,13 @@ - (OIDServiceConfiguration *) createServiceConfiguration: (NSDictionary *) servi
111111 NSURL *authorizationEndpoint = [NSURL URLWithString: [serviceConfiguration objectForKey: @" authorizationEndpoint" ]];
112112 NSURL *tokenEndpoint = [NSURL URLWithString: [serviceConfiguration objectForKey: @" tokenEndpoint" ]];
113113 NSURL *registrationEndpoint = [NSURL URLWithString: [serviceConfiguration objectForKey: @" registrationEndpoint" ]];
114-
114+
115115 OIDServiceConfiguration *configuration =
116116 [[OIDServiceConfiguration alloc ]
117117 initWithAuthorizationEndpoint: authorizationEndpoint
118118 tokenEndpoint: tokenEndpoint
119119 registrationEndpoint: registrationEndpoint];
120-
120+
121121 return configuration;
122122}
123123
@@ -142,11 +142,11 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
142142 redirectURL: [NSURL URLWithString: redirectUrl]
143143 responseType: OIDResponseTypeCode
144144 additionalParameters: additionalParameters];
145-
146-
145+
146+
147147 // performs authentication request
148148 AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication ].delegate ;
149-
149+
150150 appDelegate.currentAuthorizationFlow =
151151 [OIDAuthState authStateByPresentingAuthorizationRequest: request
152152 presentingViewController: appDelegate.window.rootViewController
@@ -157,7 +157,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
157157 } else {
158158 reject (@" RNAppAuth Error" , [error localizedDescription ], error);
159159 }
160-
160+
161161 }]; // end [OIDAuthState authStateByPresentingAuthorizationRequest:request
162162}
163163
@@ -174,7 +174,7 @@ - (void)refreshWithConfiguration: (OIDServiceConfiguration *)configuration
174174 additionalParameters : (NSDictionary *_Nullable) additionalParameters
175175 resolve : (RCTPromiseResolveBlock) resolve
176176 reject : (RCTPromiseRejectBlock) reject {
177-
177+
178178 OIDTokenRequest *tokenRefreshRequest =
179179 [[OIDTokenRequest alloc ] initWithConfiguration: configuration
180180 grantType: @" refresh_token"
@@ -186,7 +186,7 @@ - (void)refreshWithConfiguration: (OIDServiceConfiguration *)configuration
186186 refreshToken: refreshToken
187187 codeVerifier: nil
188188 additionalParameters: additionalParameters];
189-
189+
190190 [OIDAuthorizationService performTokenRequest: tokenRefreshRequest
191191 callback: ^(OIDTokenResponse *_Nullable response,
192192 NSError *_Nullable error) {
@@ -196,15 +196,17 @@ - (void)refreshWithConfiguration: (OIDServiceConfiguration *)configuration
196196 reject (@" RNAppAuth Error" , [error localizedDescription ], error);
197197 }
198198 }];
199-
199+
200200}
201201
202202/*
203203 * Take raw OIDTokenResponse and turn it to a token response format to pass to JavaScript caller
204204 */
205205- (NSDictionary *)formatResponse : (OIDTokenResponse*) response {
206206 NSDateFormatter *dateFormat = [[NSDateFormatter alloc ] init ];
207- [dateFormat setDateFormat: @" yyyy-MM-dd'T'HH:mm:ssZ" ];
207+ dateFormat.timeZone = [NSTimeZone timeZoneWithAbbreviation: @" UTC" ];
208+ [dateFormat setLocale: [NSLocale localeWithLocaleIdentifier: @" en_US_POSIX" ]];
209+ [dateFormat setDateFormat: @" yyyy-MM-dd'T'HH:mm:ss'Z'" ];
208210
209211 return @{@" accessToken" : response.accessToken ? response.accessToken : @" " ,
210212 @" accessTokenExpirationDate" : response.accessTokenExpirationDate ? [dateFormat stringFromDate: response.accessTokenExpirationDate] : @" " ,
0 commit comments