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

Getting "No credentials were found in the store." on production app #862

Closed
6 tasks done
Kaur-Pushpinder opened this issue Jul 9, 2024 · 13 comments
Closed
6 tasks done
Labels
waiting for customer This issue is waiting for a response from the issue or PR author

Comments

@Kaur-Pushpinder
Copy link

Checklist

Description

This issue is randomly reproduced while renewing the token.

Reproduction

This issue is randomly reproduced while renewing the token.
IMG_0958

Additional context

No response

Auth0.swift version

2.7.2

Platform

iOS

Platform version(s)

17+

Xcode version

15.3

Package manager

Cocoapods

@Kaur-Pushpinder Kaur-Pushpinder added the bug This points to a verified bug in the code label Jul 9, 2024
@desusai7
Copy link
Contributor

Hi @Kaur-Pushpinder,

Can you help us with the steps to reproduce ?

And is the issue #863 also opened by someone from your team ?

@Kaur-Pushpinder
Copy link
Author

@desusai7 this is a random issue, there are no specific steps. just one info it is coming in renewAuth.

@Kaur-Pushpinder
Copy link
Author

@desusai7 any update on this?

@Vaidios
Copy link

Vaidios commented Sep 5, 2024

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?

@theolampert
Copy link

@desusai7 Could you let us know if this is something your team is aware of an looking into?

@desusai7
Copy link
Contributor

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 !

@theolampert
Copy link

@desusai7 Thanks!

@theolampert
Copy link

@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.

@Widcket
Copy link
Contributor

Widcket commented Jan 10, 2025

Hi @Vaidios,

In your case, there seem to be two A0Credentials classes, one in the Auth0 framework and one in your app bundle.
Screenshot 2025-01-10 at 13 34 57

@Widcket
Copy link
Contributor

Widcket commented Jan 10, 2025

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.

@Widcket
Copy link
Contributor

Widcket commented Jan 10, 2025

Hi @Kaur-Pushpinder,

You can use the method suggested above ☝🏼 to log the underlying Keychain error.

@Widcket
Copy link
Contributor

Widcket commented Jan 10, 2025

Please report back what the underlying Keychain error was if you're still experiencing this issue.

@Widcket Widcket closed this as completed Jan 10, 2025
@Widcket Widcket added waiting for customer This issue is waiting for a response from the issue or PR author and removed bug This points to a verified bug in the code labels Jan 10, 2025
@theolampert
Copy link

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.

Thanks for the reply, I'll take a look at doing that and report back anything.

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

5 participants