This is a beginner issue, please help!
My problem is that I am not sure what returnUrl I should give which is mandatory for AuthSession.startAsync method in the bare workflow. I do get the authorization code successfully but, the problem is everytime I log in, it redirects to the ${REDIRECT_URI}
point which is the screen before I log in. My understanding for authrorization code for PCKE is that if I get the authorization code ok, I should be able to see my profile screen as I have logged in and in the backend, I also need to try to get the token linearly. or have i misunderstood the flow?
on the documentation, it says AuthSession
needs to know where to wait for the response… I don’t think I can use expo-linking as it is bare workflow. Any advices would be really appreciated I am totally stuck how to solve this issue without much experience in the mobile development.
my current redirect_uri is myapp://myapp.auth0.com/android/myapp/callback
.
I suspect that I shouldn’t use the same REDIRECT_URI for the returlUrl
in AuthSession.startAsync?!
const **redirectUri** = AuthSession.makeRedirectUri({
native: `${REDIRECT_URI}`,
});
const authenticationOptions = {
scope: 'openid profile email offline_access',
response_type: 'code',
client_id: `${AUTH0_CLIENT_ID}`,
redirect_uri: **redirectUri**,
code_challenge: challenge,
code_challenge_method: 'S256',
audience: `${AUTH0_API_AUDIENCE}`,
state: state,
};
await AuthSession.startAsync({
authUrl: authUrl,
returnUrl: `${REDIRECT_URI}`
}).then((result) => {
if (
result.type === 'success' &&
result.params &&
result.params.code &&
result.params.state === state
) {
const code = result.params.code;
console.log('code', code);
}
});