Is the login work, and you want to be able to get the user profile image?
User (role) missing scope (account)
Votes
1
Replies
24
Participants
Unknown
Messages
25
Rank 1: Thread
Yup I did a work around but it was hectic....If I want create a new User in database. How should I do that ?
Rank 1: Thread
Yup I want to get user profile image.
For just creating user programmatically use the Users Server SDK
You can use any of the create functions here: https://appwrite.io/docs/server/users
Rank 1: Thread
The sdk is for server side. I want to create users in the client side.
You'll have to do it manually I think.
For Github for example you can use
https://api.github.com/search/users?q=torvalds
You'll need to use one of the following
- OAuth2
- Email & Password - https://appwrite.io/docs/client/account?sdk=web-default#accountCreate
- Magic link - https://appwrite.io/docs/client/account?sdk=web-default#accountCreateMagicURLSession
- Phone - https://appwrite.io/docs/client/account?sdk=web-default#accountCreatePhoneSession
Do notice that in phone and magic link there is an extra step.
Admin
Why? What exactly are you trying to do?
Rank 1: Thread
What should be the flow creating the user like first check if it is already exist in the database if not create then
Admin
Are you trying to let users sign up/create their account for your app?
Rank 1: Thread
I guess when the user gets logged in during that point of time userData sets to null. That's why I was not able to get the data.
So what I did was I waited for the user to log in then after that get the account.get()
Rank 1: Thread
Yes sir
Admin
Yes, account.get() needs to be called after a session is created
Rank 1: Thread
Yup It was not working in the same function even if I use async await
Admin
Creating an oauth2 session will automatically create a user if they don't exist.
Otherwise, you can use account.create()
Rank 1: Thread
I want to store that data in the database.
Admin
Right because of what Byawitz said: https://discord.com/channels/564160730845151244/1111116935938187294/1111119219094994966
Rank 1: Thread
It will be better if we could call it in the same function with then and catch statements
Rank 1: Thread
How to do that ?
Admin
You can't because that's not how the OAuth2 works...the create oauth2 session function opens a new tab/window for the oauth2 flow. After the tab is created, execution continues, but the session hasn't been created yet
Rank 1: Thread
okk. Thank you sir got it. Could help how to setup intialise database with name and email after authentication. And also check it already exists ?
Admin
Maybe you should read up on database design first. This is a little outdated, but principles still apply https://dev.to/appwrite/30daysofappwrite-database-design-140a
Rank 1: Thread
How to get the spotify Authorisation token when logging through AppWrite ?
Moderator
Are you using nextjs for the frontend?
Admin
providerAccessToken from the OAuth2 Session: https://appwrite.io/docs/models/session