Back

account .get() not working on fast api backend.

  • 0
  • Self Hosted
  • Auth
  • REST API
cryptobitez
7 May, 2024, 17:57

I have a fast api backend, nextjs front end. I've create an email session and trying to run account.get(). I get error: User (role: guests) missing scope (account).

My code: app = FastAPI() #database= databases(client) client = Client() client.set_endpoint('xxxx').set_project('xxxxx') account = Account(client)

@app.post("/api/login", status_code=status.HTTP_200_OK ) async def login( credentials : logincred , response: Response): try:

response= account.create_email_password_session( credentials.email, credentials.password) print('succesful session') current_account= await account.get() Response.set_cookie(key= 'login', value= current_account , httponly= True , secure= True, max_age= 10 * 60 * 24) print('sucess') return { 'user' : current_account['name']}

return {'user': current_account , 'session':sessiontoken}

except Exception as e: print(e) raise HTTPException(status_code = status.HTTP_403_FORBIDDEN ) # Return an appropriate error status code

I want to have a seperate back end and front. How do i get past this?I'm working for a start up with revenue and as much as i like appwrite figuring it out for every small thing is getting exhausting.

I need to create a platform with oath2, mfa, password reset and jwt. all accesible from a fast api backend, starting to dread these constant issues for what initially looks simple.

TL;DR
Developers using FastAPI backend with Next.js frontend encountering 'User missing scope (account)' error when running account.get(). Goal is to create separate backend and frontend for platform with OAuth2, MFA, password reset, and JWT functionalities. Requesting guidance on overcoming current issue and expressing exhaustion with troubleshooting.
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