#Google and Apple sign in
28 messages · Page 1 of 1 (latest)
With a function triggered on user creation
I think the OP wants to fetch those from the OAuth Provider if I am not wrong.
I think it will not be possible to get that directly from the oAuth provider (at least in most cases) due to privacy and security reasons
So I have to create another form for filling in these details.??
There are some websites that use Google data though
Once the user logins with Google, you can get the data from Appwrite
I want on get Google data on sign-up so I create user table with photo url, name, email etc from google
You mean externally, and not in Appwrite, true?
In appwrite
Then the solution is without any doubts the one I suggested you: after the user logins, you get the name, email, etc with a function and create a new document in a collection with such data
Just like in some websites you just sign in with Google and all other info is fetched from google acc
How do you get name and email from google auth
Does it also get the photourl
Lemme check the outh2 function and see how to fetch name and email so i can put it in the users table
I do it this way:
- User clicks login with Google button
- If the Auth flow is correct, the function is triggered from client side
- In the function I get the user that triggered the function and I create with such data a new document
It will not duplicate data if you set document ID as user ID, since it it's an user that logins again, it will throw an error of document with an existing ID
Yes yes
It's possible to do it too with appwrite account creation action, but I prefer that way 😅
(Mainly because in old appwrite versions oAuth didn't trigger that)
Also I recommend triggering it in async mode
Same for apple oauth right.?
Yes, same for all oAuth and even email registering
After creating an oauth session, fetch the session. It should have an access token from the oauth provider. You can try using that access token to make API calls to the provider and fetch other things like profile picture
Lemme try this one. Thanks @sly pecan