Back

Save user after

  • 0
  • Web
calipher
25 May, 2023, 08:23

how to disable it?

TL;DR
The user is experiencing an error related to OAuth sign-in. They are using Next Auth and attempting to store user data in a database. They have tried rebuilding the app and adding the 'use client' code, but are still getting the same errors. Another user suggests using backticks for readability. The error appears to be related to missing user scopes ('User (role: guests) missing scope (account)'). The user is advised to Google and find a better solution for their use case. There is no solution provided in the thread.
safwan
25 May, 2023, 08:25

what i do, is kind of a hacky way to do it. I add a 'use client' to the top of the file, which converts the whole component into a client component

safwan
25 May, 2023, 08:26

it's best if you google and check what works best for your use case

calipher
25 May, 2023, 08:26

ok thanks

calipher
25 May, 2023, 08:31

User (role: guests) missing scope (account)

calipher
25 May, 2023, 08:31

still

calipher
25 May, 2023, 08:34

XHRGET https://cloud.appwrite.io/v1/account [HTTP/2 401 Unauthorized 168ms]

XHRGET https://cloud.appwrite.io/v1/account [HTTP/2 401 Unauthorized 169ms]

AppwriteException: User (role: guests) missing scope (account) AppwriteException sdk.js:82 call sdk.js:391 fulfilled sdk.js:22 promise callback*step sdk.js:24 fulfilled sdk.js:22 promise callback*step sdk.js:24 __awaiter sdk.js:25 __awaiter sdk.js:21 call sdk.js:341 get sdk.js:427 __awaiter sdk.js:25 __awaiter sdk.js:21 get sdk.js:423 fetchUser Home.js:19 Home Home.js:27 React 8 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 EventHandlerNonNull* scheduler.development.js:571 <anonymous> scheduler.development.js:633 NextJS 4 <anonymous> index.js:6 js NextJS Home.js:22:14 AppwriteException: User (role: guests) missing scope (account)

joeyouss
25 May, 2023, 08:35

can you please use backtick to make it more readable?

joeyouss
25 May, 2023, 08:36

` symbol

safwan
25 May, 2023, 08:37

@sugam-pokhrel please share the code where you implement OAuth sign in

calipher
25 May, 2023, 08:37
calipher
25 May, 2023, 08:38

code for signin in ` export const Signin = () => {

TypeScript
const  googleAuth= async(e)=>{
    e.preventDefault();

await account.createOAuth2Session('google','http://localhost:3000/home&#39;,&quot;http://localhost:3000/login")

TypeScript
}

return ( <div>Signin

TypeScript
  <button onClick={(e)=>{googleAuth(e)}}>Gauth</button>
</div>

) } `

safwan
25 May, 2023, 08:39

why are you using e.preventDefault()

safwan
25 May, 2023, 08:39

OAuth in appwrite opens a new window/tab for the login.

calipher
25 May, 2023, 08:39

it is working though

calipher
25 May, 2023, 08:39

but

calipher
25 May, 2023, 08:39

let me change that

calipher
25 May, 2023, 08:40

still those same error come up

calipher
25 May, 2023, 08:40

same erros

safwan
25 May, 2023, 08:43

did you add the use client

calipher
25 May, 2023, 08:43

yes

calipher
25 May, 2023, 08:43

on the top of the file

safwan
25 May, 2023, 08:43

did you rebuild the app?

calipher
25 May, 2023, 08:44

yes

calipher
25 May, 2023, 08:46

the error is a mess rather i will create a oauth session from next auth than store the userData on db by passing credentials

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