Back

Problem with login using google OAuth

  • 1
  • Accounts
  • Flutter
pitcairn1987
28 Feb, 2023, 13:22

Hi, I have a problem to login via google oAuth in my Flutter mobile app. What should return createOAuth2Session function? In my case, after login by google I get a screen with "missing redirect..." error just for second and then back to login page. Function returns null and session is not created. But in Appwrite console I see that account is created and verified.

TL;DR
User is having trouble logging in via Google OAuth in their Flutter mobile app. They are getting a "missing redirect..." error. The function `createOAuth2Session` is returning null and the session is not being created. However, in the Appwrite console, the account is shown as created and verified.
Drake
28 Feb, 2023, 17:33

right...it actually doesn't return the session, but the user should be authenticated based on the flow you describe 🧐

Drake
28 Feb, 2023, 17:33

Are you able to call account.get() right after?

pitcairn1987
1 Mar, 2023, 19:24

yes, I call account.get() and have 401 error. Strange because in Appwrite panel I see that account is created and even session

Drake
1 Mar, 2023, 19:46

what's your code? Are you using the same Client instance across your codebase?

pitcairn1987
3 Mar, 2023, 20:42

I've looked into this issue a bit more. And I know exactly when it occurs. In the first video, I log in to the account that is saved earlier in the browser. Log in works and logout does the same. In the second video, I log in to an account that is not saved in the browser. I enter the password and login succeeds. However, log out is not successful. It's strange because before( by account.get() ) method I check the previously created session and close the login page based on this. The session is also visible in Appwrite panel

Drake
3 Mar, 2023, 20:47

Log in to account that is saved earlier? Appwrite sdk persists sessions so you shouldn't have to log in again 🧐

Drake
3 Mar, 2023, 20:50

What's the code with the account.get() and logout?

Drake
3 Mar, 2023, 20:51

And how are you initializing and using Client in your codebase?

pitcairn1987
3 Mar, 2023, 21:09

No. I mean I saved before credential in browser only. Then I open my app. In 1st video everything is ok. I login only once and session is holded. Sesond video is after reinstallation app and delete credential from browser

Drake
3 Mar, 2023, 21:11

Weird...that shouldn't affect the oauth flow...

pitcairn1987
3 Mar, 2023, 21:12

I will send piece of code tommorow

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