Rank 6: Server
In web
I created a session using oauth.
I run the app
logged in
but closed the terminal
and ran again opened the app(I have now 2 running app in different tab) session is ok
close every tab and terminal
re run the app there is no session.
Either expo clearing the cookies set by appwrite or something else is happening .
check is this is the reason
if (Platform.OS === 'web') { // Web: get params from window.location const params = new URLSearchParams(window.location.search); const secret = params.get('secret'); const userId = params.get('userId');
if (secret && userId) { try { const res = await account.createSession(userId, secret); console.log(res); window.history.replaceState({}, document.title, window.location.pathname); return await getAccount(); } catch (e) { console.error('Failed to create session:', e); return null; } } return null; }this is my code.
why am I using url search on window?
const result = await WebBrowser.openAuthSessionAsync(loginUrl, scheme);this is opening a another window (smaller) and redirects in that window. My app is not able to catch that params, which is in the new window.
so I set the redirect url as a screen for web and instead of opening new window i dont do anything
and on redirect
the screen catches the url and creates session. but after that the thing happens what i said at the start.
Stuck on development.
(Works on expo go)