Getting "No credentials were found in the store." on production app
Checklist
- [X] The issue can be reproduced in the Auth0.swift sample app (or N/A).
- [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
This issue is randomly reproduced while renewing the token.
Reproduction
This issue is randomly reproduced while renewing the token.
Additional context
No response
Auth0.swift version
2.7.2
Platform
iOS
Platform version(s)
17+
Xcode version
15.3
Package manager
Cocoapods
Hi @Kaur-Pushpinder,
Can you help us with the steps to reproduce ?
And is the issue #863 also opened by someone from your team ?
@desusai7 this is a random issue, there are no specific steps. just one info it is coming in renewAuth.
@desusai7 any update on this?
I am also experiencing similar issue, though I've been able to determine that in my case it breaks on NSKeyedUnarchiver
[path/ios.app]"
)}" UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'A0Credentials' (0x105529ff8) [/path/ios.app/Frameworks/Auth0.framework].
Allowed classes are:
{(
"'A0Credentials' (0x101562e50) [path/ios.app]"
)}}
Is there any particular reason why NSKeyedUnarchiver is used instead of Swift's JSONDecoder?
@desusai7 Could you let us know if this is something your team is aware of an looking into?
Hi @theolampert, @Vaidios,
Thank you for sharing more details on the issue and raising a PR to address this, we will look into it and get back to you !
@desusai7 Thanks!
@desusai7 As an interum solution would you accept a PR that made the credentialManager's decoding method throwing so that those of who've noticed this could try to eliminate the cause and gather more info?
This would be a breaking change.
Hi @Vaidios,
In your case, there seem to be two A0Credentials classes, one in the Auth0 framework and one in your app bundle.
Hi @theolampert,
You can create a custom storage type conforming to CredentialsStorage that proxies to SimpleKeychain, and use it to log any Keychain errors.
E.g.
let credentialsManager = CredentialsManager(authentication: authentication,
storage: ProxyStore())
You can see how Auth0.swift uses SimpleKeychain here: https://github.com/auth0/Auth0.swift/blob/master/Auth0/CredentialsStorage.swift#L30
Specifically, you'd need to catch the error here instead of using try?.
That is because Auth0.swift v2.0.0 came out before SimpleKeychain v1.0.0 (in which the decoding method became throwing), and thus, this solution was needed to avoid a breaking change in Auth0.swift.
Hi @Kaur-Pushpinder,
You can use the method suggested above ☝🏼 to log the underlying Keychain error.
Please report back what the underlying Keychain error was if you're still experiencing this issue.
Hi @theolampert,
You can create a custom storage type conforming to
CredentialsStoragethat proxies to SimpleKeychain, and use it to log any Keychain errors.E.g.
let credentialsManager = CredentialsManager(authentication: authentication, storage: ProxyStore())You can see how Auth0.swift uses SimpleKeychain here: https://github.com/auth0/Auth0.swift/blob/master/Auth0/CredentialsStorage.swift#L30 Specifically, you'd need to catch the error here instead of using
try?.That is because Auth0.swift v2.0.0 came out before SimpleKeychain v1.0.0 (in which the decoding method became throwing), and thus, this solution was needed to avoid a breaking change in Auth0.swift.
Thanks for the reply, I'll take a look at doing that and report back anything.