AtticusZeller / fastapi_supabase_template

👏fastapi deeply integrates with supabase,auth,curd postgresql,file upload ,etc , all in one😎,inspired by full stack fastapi postgresql
MIT License
117 stars 6 forks source link

How i access my docs as superuser??? #141

Closed MaHDiaLaGaB closed 2 weeks ago

MaHDiaLaGaB commented 3 weeks ago

I am running the system but when i go to /docs and i need to try the endpoints i need to add O2auth it's written: Token URL: please login by supabase-js to get token how i do that? if i uncomment the lines:

await super_client.auth.sign_in_with_password(
    {"email": settings.SUPERUSER_EMAIL, "password": settings.SUPERUSER_PASSWORD}
    )

i got error await can't be used with None Type

AtticusZeller commented 3 weeks ago
  1. did you mean that do not understand how to test endpoint with doc manually?

  2. token are captured by endpoint dependency automatically,so I haven't tried to test with doc,you could make a new PR for it

  3. what's kind of token did you use?

  4. more code examples or your repo?

MaHDiaLaGaB commented 3 weeks ago

sorry my bad, i just started the template and it's run smothley except, i didn't know what value i need to put in username and password

Screenshot 2024-10-24 at 5 57 12 PM

i am using supabase locally, init supabase, and started too this is the .env i have:

SUPABASE_URL=http://127.0.0.1:54321
SUPABASE_KEY=###### supabase local secret #####
SUPERUSER_EMAIL=mad@test.com
SUPERUSER_PASSWORD=zFwICPX3FWaDXglE

i started the supabase and added a superuser in auth with the email and password that are in .env

AtticusZeller commented 3 weeks ago
  1. the token which captured by dependency is the user's access_token, so i thinks we can test it in docs after sign in manually with super_client.auth.sign_in_with_password

    response = await db_client.auth.sign_up(
        {"email": fake_email, "password": fake_password}
    )
    assert response.session.access_token is not None

    the response.session.access_token is the token dependency love,which it may work in doc

  2. the doc form looks wired

MaHDiaLaGaB commented 3 weeks ago

Thank you so much,