Is the login work, and you want to be able to get the user profile image?
Yup I did a work around but it was hectic....If I want create a new User in database. How should I do that ?
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
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.
Why? What exactly are you trying to do?
What should be the flow creating the user like first check if it is already exist in the database if not create then
Are you trying to let users sign up/create their account for your app?
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()
Yes sir
Yes, account.get() needs to be called after a session is created
Yup It was not working in the same function even if I use async await
Creating an oauth2 session will automatically create a user if they don't exist.
Otherwise, you can use account.create()
I want to store that data in the database.
Right because of what Byawitz said: https://discord.com/channels/564160730845151244/1111116935938187294/1111119219094994966
It will be better if we could call it in the same function with then and catch statements
How to do that ?
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
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 ?
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
How to get the spotify Authorisation token when logging through AppWrite ?
Are you using nextjs for the frontend?
providerAccessToken
from the OAuth2 Session: https://appwrite.io/docs/models/session
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...