You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have successfully built authentication on my NextJS app and it is working great with cookie sessions however, I was thinking what if in the future I want to authenticate a React native app with my app ?
I have seen on the docs that I can just store the session id on the native device local storage and then send it back to the server and validate it.
While this worked I am having a problem, after validating that the user session is valid I am doing something like this
Should I create separate routes one for web and one for other devices where storing the session cookie is not applicable or should I check for user agent? or something else?
I would be grateful if someone can help me figure this out.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have successfully built authentication on my NextJS app and it is working great with cookie sessions however, I was thinking what if in the future I want to authenticate a React native app with my app ?
I have seen on the docs that I can just store the session id on the native device local storage and then send it back to the server and validate it.
While this worked I am having a problem, after validating that the user session is valid I am doing something like this
const session = await lucia.createSession(user.id, {});
const { name, value, attributes } = lucia.createSessionCookie(session.id);
cookies().set(name, value, attributes);
return new Response(session.id, { status: 200 });
Should I create separate routes one for web and one for other devices where storing the session cookie is not applicable or should I check for user agent? or something else?
I would be grateful if someone can help me figure this out.
Beta Was this translation helpful? Give feedback.
All reactions