Skip to content
Back

How to pass session from browser to a mobile app (Flutter)

  • 0
  • 1
  • Self Hosted
  • Auth
  • Flutter
  • Web
BugsBunnny
14 Oct, 2025, 14:08

I have a self-hosted Appwrite container. I also have a www page (A) which should acts as login page for different www services (B). User click login in B, is redirected to A, logs in, he is redirected back to A. On A is executed Appwrite function and Appwrite sets cookie with a session to the domain B. it works. But the same scheme doesn't work for the apps, in my case Flutter app. I want in Flutter to click login button, be redirected to the website A, login and be redirected back with working session (kinda like SSO works). So my question is: How to implement this? Currently it works for me only via JWT tokens, but they expire very soon. How to open session in the Flutter app after being logged in the browser? What is the exact algorithm? Thanx a lot for any help!

TL;DR
To pass a session from the browser to a mobile app in Flutter, you can use createSession() with a secret generated by users.createToken() on the server. However, if you encounter the "user_more_factors_required" error, it means that more factors are needed for sign-in. This might be caused by using 2FA, which could restrict the use of the web page as a single sign-on (SSO) method.
14 Oct, 2025, 15:47

I tried to use createSession() with secret generated by users.createToken() on server, but it still doesn't work for me. I get this error: AppwriteException: user_more_factors_required, More factors are required to complete the sign in process. (401) If I use 2FA I can't use my web page as SSO?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more