Possibility to access signinCallback function?
I have a website that is also converted into an app via Capacitor. The login on the website works without any problems. But not for the native app. There is a hook for Capacitor when the redirect URL is called from the auth provider.
CapApp.addListener("appUrlOpen", async ({ url }) => {
// TODO: handle URL
});
A URL is returned that contains the code & session_state. I would need to call a function there to handle the URL (not window.location.href). Is there a way to do this?
In auth0-react there is a function called "handleRedirectCallback(url)" that does just that.
Have you tried onSigninCallback? See https://github.com/authts/react-oidc-context/blob/main/src/AuthProvider.tsx#L42
Have you tried
onSigninCallback? See https://github.com/authts/react-oidc-context/blob/main/src/AuthProvider.tsx#L42
Thank you for the fast response! How should I use this event? The user is not yet authorized at this time.
The process is:
- User opens app
- App opens in-app browser with authority login URL
- Authority redirects back to app via schema URL (com.example.app://capacitor.../callback?code=xyz...)
- Now I have the schema URL in the hook I sent above. Here I need a way to process the response, since the AuthProvider is not triggered via the in-app browser
If I think correctly, I need access to this method via useAuth hook:
https://github.com/authts/react-oidc-context/blob/39bad747a847d8c82881f4f7e5e737255c89a871/src/AuthProvider.tsx#L237
https://github.com/authts/oidc-client-ts/blob/8a386f559cbb4d605660f8a3040a4ec2b1cf11c4/src/UserManager.ts#L368
Here I can specify my custom URL to log in the user.
If I think correctly, I need access to this method via useAuth hook:
You can register your own function of onSigninCallback via setttings into the auth context <AuthProvider onSigninCallback={(user) => console.log(user)} ...>....