Hi!
I am using Capacitor.js to run our Next.js application as a hybrid app on iOS. It uses the Auth0 React SDK.
When users attempt to log in on the iOS app, our custom Auth0 domain is opened in Safari. After logging in, they are returned to our app. However, the Auth0 logs show a “Failed Silent Auth” error with the description “Login required”.
After reading through various fora, I think I’ve narrowed this down to being an issue with Safari not sharing cookies with the Web View that is used by Capacitor.js to display the app. Showing our auth domain directly in the application (inside the Web View) is not an option, since Google SSO does not allow this.
Any help with getting this issue resolved would be greatly appreciated.
Hi @employee451,
I’m not very familiar with the stack you’re using, but as far as the third-party cookie issue, have you tried using cacheLocation: "localstorage"
in your Auth0Provider component? Also, are you specifying an API identifier for the audience in the provider component?
<Auth0Provider
domain={REACT_APP_AUTH0_DOMAIN}
client_id={REACT_APP_AUTH0_CLIENT_ID}
audience={API_IDENTIFIER}
redirect_uri={window.location.origin}
onRedirectCallback={onRedirectCallback}
useRefreshTokens
cacheLocation="localstorage"
>
FAQ: Why is authentication lost after refreshing my single page application?
Thanks for your responce, @stephanie.chamblee.
I have set cacheLocation: "localStorage"
in the Auth0Provider.
I am also specifying an API identifier for the audience in the provider.
The only place where I’m having this issue is with the iOS hybrid app. It’s not an issue when logging in directly in Safari or any other browsers.