-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add configurable timeout fn param (connectionTimeoutSeconds/connectionTimeoutMillis) #701
Conversation
platform === 'android' && connectionTimeout > 0 | ||
? connectionTimeout * MILLI_PER_SEC | ||
: connectionTimeout; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course iOS uses seconds and Android milliseconds 🤦 .
@@ -78,6 +85,7 @@ export const prefetchConfiguration = async ({ | |||
serviceConfiguration, | |||
dangerouslyAllowInsecureHttpRequests = false, | |||
customHeaders, | |||
connectionTimeoutSeconds = 0, | |||
}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to pass a default value of null
here because of the Java type. Even though Double can hold a null
value, the conversion by React-Native of this arg to the Java type Double failed for null.
@@ -63,6 +63,7 @@ | |||
private final ReactApplicationContext reactContext; | |||
private Promise promise; | |||
private boolean dangerouslyAllowInsecureHttpRequests; | |||
private Double connectionTimeoutMillis; | |||
private Boolean skipCodeExchange; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -42,6 +42,7 @@ describe('AppAuth', () => { | |||
usePKCE: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the test cases seem off in this file. The refresh
block has some redundant authorize
validation cases 🙀 - probably just a bad copy/pasta. Anyway, I'll get those shaped up.
it('throws an error when issuer is not a string and serviceConfiguration is not passed', () => { | ||
expect(() => { | ||
authorize({ ...config, issuer: () => ({}) }); | ||
refresh({ ...config, issuer: () => ({}) }, { refreshToken }); | ||
}).toThrow('Config error: you must provide either an issuer or a service endpoints'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant authorize
assertions that were mentioned.
…nTimeoutMillis to java methods
8110747
to
e378777
Compare
@@ -44,12 +44,13 @@ - (dispatch_queue_t)methodQueue | |||
subjectType: (NSString *) subjectType | |||
tokenEndpointAuthMethod: (NSString *) tokenEndpointAuthMethod | |||
additionalParameters: (NSDictionary *_Nullable) additionalParameters | |||
connectionTimeoutSeconds: (double) connectionTimeoutSeconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #236 #479
Description
Random addition
warmAndPrefetchChrome
fn param (fixes 479)Steps to verify
(not sure if this is the best way to go about it 🤷♂️ )
cp -r ios Example/node_modules/react-native-app-auth && cp -r android Example/node_modules/react-native-app-auth && cp index.js Example/node_modules/react-native-app-auth && cp react-native-app-auth.podspec Example/node_modules/react-native-app-auth
change the
issuer
property of the identityserver config in Example/App.js to a url that will never resolve (ex. http://www.example:81.com)If the url doesn't use https protocol, add
dangerouslyAllowInsecureHttpRequests: true
to the argument object passed to the 'authorize' method in Example/App.js.Run the Example app and attempt to authorize through identity server. The default timeout is 60 seconds for iOS and 15 seconds for Android. It should be apparent that the configured timeout of 5 seconds is being respected.