Back

Some Error with different Ways for create User

  • 0
  • Web
  • Cloud
enixcore
29 Feb, 2024, 02:24

Hello, i'm new with appwrite and trying some functions with it. First i wanna create a way to register user or using OAuth2 for Google. What ever I do, it doesnt work https://prnt.sc/QdiFbDAAb-sO this is just a small script taking input from form and send it with account.create for creating user. getting 500 https://prnt.sc/Ier6aEpn9jnN Next I create just a button with selfwritten values for creating, same 500 error the last way i was trying was to create a google Session with OAuth2 https://prnt.sc/8AjhgMAmfP72 click on button, asked which account i will use, if i'm sure i wanna log in and at the end i get redirected into my failure page I was double checking if the redirect-uri from appwrite was right and client id + client secret was copied properly. I'm really not sure what I do wrong. If you need more infos just tell me what.

TL;DR
Developers are having trouble creating a user in an app using different methods, including generating a unique ID and using OAuth2 for Google. They are encountering a 500 error for passing an empty string as the user ID, and also facing issues with OAuth authentication. The solution is to ensure the user ID is not left blank when creating an account. Additionally, for the OAuth problem, they need to check if there are any extra parameters in the URL on the failure page.
Steven
29 Feb, 2024, 02:30

For the create account, you're passing an empty string for the user id which isn't allowed.

For the oauth problem, is there anything else in the URL on the failure page?

enixcore
29 Feb, 2024, 02:36

i was thinking when i send a blank for id it would be created automaticlly, because with ID.unique() i just get the string "unique()", and just to send email and password doesnt work because it needs 3 parameters right?

http://localhost:3000/failure?error=%7B%22message%22%3A%22Failed+to+obtain+access+token.+The+Google+OAuth2+provider+returned+an+error%3A+invalid_client%3A+Unauthorized%22%2C%22type%22%3A%22user_oauth2_unauthorized%22%2C%22code%22%3A401%7D if i read it right, my secret or id are wrong. I used this https://prnt.sc/T34gUksQUGAZ Client ID as App ID and secret as App Secret for appwrite

Steven
29 Feb, 2024, 02:36

No you can't pass an empty string

Steven
29 Feb, 2024, 02:37

You created a web app oauth client?

Steven
29 Feb, 2024, 02:38

Maybe there's extra space or something

enixcore
29 Feb, 2024, 02:38

yes i did, was a fresh one

enixcore
29 Feb, 2024, 02:40

oh, after multiple times I copied the secret it was always a space as first character and i was never checking by clicking on the eye....

enixcore
29 Feb, 2024, 02:42

great, just 2 errors left... when i cant send a blank id and ID.unique() gives me the string "unique()" what should i try? maybe user api instead of account api? (hasnt checked user api actually)

Steven
29 Feb, 2024, 02:43

Pass ID.unique() like the docs suggest

enixcore
29 Feb, 2024, 02:43

not sure what I did wrong the last 6 hours after trying to use ID.unique() but it passed now...

Steven
29 Feb, 2024, 02:47

Glad it's working! However, we really shouldn't be responding with 500 due to empty string for the id. Would you be able to create a GitHub issue for that so we can improve the error handling?

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