Back

Bout to deploy my app- authenticate google oauth token

  • 0
  • Auth
cryptobitez
4 Feb, 2025, 21:05

Trying to authenticate user using cookie- the cookie stores the 'secret' code. Literally following the guide on the website. Thinking at minimum the guideline code should work ?

I'm getting the error:
User (role: guests) missing scope (account)

i take the secret from the google auth sign in (in the url/ poor practise- don't understand how it's done this way) then i set the session with the secret from the cookie and use that to account.get()- see below- (python-fastapi server side) `` client2=Client() sessionclient= client2.set_endpoint('https://cloud.appwrite.io/v1').set_project('xx')

@app.post("/api/newforumpost", status_code=status.HTTP_200_OK) async def newpostforum( request: Request , post_title: str = Form(...) , post_body: str = Form(...) , Forum_name: str = Form(...), postimages: list[UploadFile] = File(None) ): try: greencookie= request.cookies.get('greenvillelogin') #print(forumnamedict[Forum_name.capitalize()]) sessionclient.set_session(greencookie) account = Account(sessionclient) user = account.get() print(user) forumpostimages=[]``

TL;DR
Developers is trying to authenticate a user using a Google OAuth token stored in a cookie but encountering an error about missing scope 'account'. They are using an endpoint and project with session set up from the cookie for the account get request. The issue might be related to the scope settings.
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