Back

authenticate user with OAuth2

  • 0
  • Users
jaydenclerk
1 Aug, 2023, 22:29

Hey am just wondering if am not using my sdk ( am using rest api) and i have a login with google can I pass the oAuth2 token from the redirect url in the header when making a call? Like in the screenshot instead of the x fallback cookie I put the token

TL;DR
The user is having trouble authenticating a user with OAuth2 in their Flutter app. They are unsure how to mark a post as solved. They ask for help in extracting a value from a URL. Another user provides a URL and suggests using a deeplink to extract the secret. The user then asks if this can be done in FlutterFlow and with REST API calls. They also ask about the code to be extracted from the redirect URL and which OAuth2 token to use. Lastly, they inquire about passing the OAuth2 token in the header when making API calls. It is recommended not to handle the OAuth2 Auth Code directly and to
Drake
1 Aug, 2023, 22:56

which oAuth2 token?

jaydenclerk
1 Aug, 2023, 22:57

Aren’t we supposed to extract a code from the redirect url?

Drake
1 Aug, 2023, 22:58

im not sure which code you're talking about. there are a couple

jaydenclerk
1 Aug, 2023, 23:02
jaydenclerk
1 Aug, 2023, 23:03

So what am trying to accomplish is similar to when creating a session with email and password I can grab the fallback cookies and use it in any subsequent request, after I authenticate the user with oAuth2 provider I don’t know what my header should be for subsequent requests

Drake
1 Aug, 2023, 23:04

This looks like the OAuth2 Auth Code, which is something you shouldn't be handling.

Drake
1 Aug, 2023, 23:04

in flutter mobile?

jaydenclerk
1 Aug, 2023, 23:07

No I know how to do it with flutter, am using flutterflow right now with rest api call that’s why am lost, i have use oAuth2 with xano in flutterflow am trying it with appwrite now

Drake
1 Aug, 2023, 23:11

You'll need to send the user to this URL: https://github.com/appwrite/sdk-for-flutter/blob/f8480fdeecfb23782bd5b33d0e2a7db44fc8c391/lib/services/account.dart#L477-L506

The sucess url should be a deeplink with a path of /auth/oauth2/success. Then, you can pull the secret out like the SDK does: https://github.com/appwrite/sdk-for-flutter/blob/f8480fdeecfb23782bd5b33d0e2a7db44fc8c391/lib/src/client_io.dart#L319-L329

jaydenclerk
1 Aug, 2023, 23:28

Thank I think I found what I need correct me if am wrong, I need to extract the value I circled in the picture with deep link right?

jaydenclerk
1 Aug, 2023, 23:42

How do I mark this as solve

Drake
1 Aug, 2023, 23:45

edit post and update the name

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