Skip to content
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

iOS SDK Offline authentication with WiFi #650

Closed
MysticMedia opened this issue Jan 28, 2021 · 5 comments
Closed

iOS SDK Offline authentication with WiFi #650

MysticMedia opened this issue Jan 28, 2021 · 5 comments
Labels
waiting for customer This issue is waiting for a response from the issue or PR author

Comments

@MysticMedia
Copy link

Hi,

We are using Auth0 iOS Siwft SDK into our app. Our app needs to authenticate user in both situation with and without internet connection. Everything is working fine however we are running into issue at offline authentication when device is connected to WiFi but there is no active internet connection. At that time Auth0 SDK keeps trying to connect to internet with no luck and not switching to offline auth method preventing user to proceed further.

Reproduction

Detail the steps taken to reproduce this error, and whether this issue can be reproduced consistently or if it is intermittent.

  • It can be reproduce everytime, Just have iOS device connected to WiFi with no internet connection and it will stuck into authenticating loop.

Version of Lock.swift used:

  • 1.0

Version of iOS:

  • iOS 11.0 and above

Version of Xcode:

  • 12.3
@Widcket
Copy link
Contributor

Widcket commented Jan 29, 2021

Hi @MysticMedia, an internet connection is required to log in. Once the user is logged in, you can store the credentials in your app and then on launch use the expiration timestamp to check if they're still valid. If the credentials are still valid, then you don't need to perform login again. This step does not require an internet connection.

Once the credentials expire, you can use the refresh token (use the offline_access scope to get one) to get new credentials and keep the user logged in.

Please check out the Auth0.swift User Sessions QuickStart to learn more. Does that help?

@Widcket Widcket added the waiting for customer This issue is waiting for a response from the issue or PR author label Jan 29, 2021
@MysticMedia
Copy link
Author

MysticMedia commented Jan 29, 2021 via email

@MysticMedia
Copy link
Author

Here is some additional info.

After checking token expiry with function "credentialsManager.hasValid()", we are fetching current user's credentials using SDK's function

credentialsManager.credentials { error, credentials in
guard error == nil, let credentials = credentials else {
return callback(error)
}
self.credentials = credentials
callback(nil)
}

in this function it tries to connect to Internet and goes into loop.

@Widcket
Copy link
Contributor

Widcket commented Jan 29, 2021

@MysticMedia can you provide a video of the loop you're talking about? If the SDK can't reach Auth0's servers, then the data task should fail with an error.

Also, the request will only take place if the credentials have expired. What is your use case for wanting expired credentials?

@Widcket
Copy link
Contributor

Widcket commented Feb 23, 2021

Closing due to inactivity.

@Widcket Widcket closed this as completed Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for customer This issue is waiting for a response from the issue or PR author
Projects
None yet
Development

No branches or pull requests

2 participants