![](https://cdn.discordapp.com/avatars/501682973754654721/67f65cc488c429ad93589cb21b1c85fe.webp)
Is the login work, and you want to be able to get the user profile image?
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
Yup I did a work around but it was hectic....If I want create a new User in database. How should I do that ?
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
Yup I want to get user profile image.
![](https://cdn.discordapp.com/avatars/501682973754654721/67f65cc488c429ad93589cb21b1c85fe.webp)
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
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
The sdk is for server side. I want to create users in the client side.
![](https://cdn.discordapp.com/avatars/501682973754654721/67f65cc488c429ad93589cb21b1c85fe.webp)
You'll have to do it manually I think.
For Github for example you can use https://api.github.com/search/users?q=torvalds
![](https://cdn.discordapp.com/avatars/501682973754654721/67f65cc488c429ad93589cb21b1c85fe.webp)
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.
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Why? What exactly are you trying to do?
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
What should be the flow creating the user like first check if it is already exist in the database if not create then
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Are you trying to let users sign up/create their account for your app?
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
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()
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
Yes sir
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Yes, account.get() needs to be called after a session is created
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
Yup It was not working in the same function even if I use async await
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Creating an oauth2 session will automatically create a user if they don't exist.
Otherwise, you can use account.create()
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
I want to store that data in the database.
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Right because of what Byawitz said: https://discord.com/channels/564160730845151244/1111116935938187294/1111119219094994966
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
It will be better if we could call it in the same function with then and catch statements
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
How to do that ?
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
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
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
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 ?
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
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
![](https://cdn.discordapp.com/avatars/488361850518634496/c933b909e42a22ff45a12daf7a8227b2.webp)
How to get the spotify Authorisation token when logging through AppWrite ?
![](https://cdn.discordapp.com/avatars/365301924607557634/1b525bfe8dc5c3f2d376dc4557222859.webp)
Are you using nextjs for the frontend?
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
providerAccessToken
from the OAuth2 Session: https://appwrite.io/docs/models/session
Recommended threads
- Bug: Document data not visible in dashbo...
My Subject collection is not showing the created document's data/attribute values Also when I click on Data then the website becomes unresponsive for some time...
- Collection creation not working
Hi I tried to create new collection almost 8-9 hours ago. Still the attributes of the new collection are showing peocessing state I even tried to create sample ...
- [401] Access to this resource is blocked...
Recently I found that my console is blocked. Perhaps somebody did try to upload more documents than allowed... I'll add limitation but anybody can help to unblo...
![](/images/bgs/pre-footer.png)