I saw the documentation but need help about the redirect url. In expo, the user account is created but I am redirected to a separate project in web , the smaller web window is opened and account is created but the smaller window does not close but opens the web app again (I assume redirects ) in that small window. Never used oauth before π Here is the code
const deepLink = new URL(makeRedirectUri({preferLocalhost: true}));
if (!deepLink.hostname) {
deepLink.hostname = 'localhost';
}
const scheme = `${deepLink.protocol}//`; // e.g. 'exp://' or 'playground://'
// Start OAuth flow
const loginUrl = await account.createOAuth2Token(
provider,
`${deepLink}`,
`${deepLink}`,
);
// Open loginUrl and listen for the scheme redirect
const result = await WebBrowser.openAuthSessionAsync(`${loginUrl}`, scheme);
// Extract credentials from OAuth redirect URL
const url = new URL(result.url);
const secret = url.searchParams.get('secret');
const userId = url.searchParams.get('userId');
// Create session with OAuth credentials
const res = await account.createSession(userId, secret);
console.log('Session created:', res);
// Redirect as needed
I also wanted to know if I have to change anything if the site is deployed or I make a apk version instead of using localhost or expo
More info about expo redirecting to a wrong project when The web browser closes expo shows this
in web its like this
Recommended threads
- Appwrite sites Issue
Hello Appwrite Support, I'm experiencing a connectivity issue with my Appwrite Cloud project hosted in the **Frankfurt (fra)** region. **Project details** * ...
- Project paused despite active use β rest...
Hey team! My Appwrite Cloud project (685579e5000d78e67009) has been marked as paused due to inactivity, but it's actively used in production. I clicked the Rest...
- My Bill
I have an old project from appwrite 2 years ago and I did not pay a 15 usd. Now I am planning to pay it so I can reuse my Card. now I was shocked why it became ...