/web-backend-supabase-fastapi

Back-End FastAPI with Supabase

Primary LanguagePython

Back-End FastAPI wihth Supabase

.env

SUPABASE_URL=""
SUPABASE_KEY=""

Endpoint

POST http://127.0.0.1:8000/signup

{
  "email": "string",
  "password": "string"
}
curl -X 'POST' \
  'http://127.0.0.1:8000/signup' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "string",
  "password": "string"
}'
  • if success return
{
  "status": "ok",
  "data": {
    "user": {..........
    ......: ..........
    }
  }

POST http://127.0.0.1:8000/signin

{
  "email": "string",
  "password": "string"
}
curl -X 'POST' \
  'http://127.0.0.1:8000/signin' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "string",
  "password": "string"
}'
  • if success return
{
  "status": "ok",
  "data": {
    "user": {
      "id": ".....",
      "app_metadata": {
        "provider": "email",
        "providers": ["email"]
      },
      "user_metadata": {},
      "aud": "authenticated"
    }
  }
}
  • else return
{
  "status": "ok",
  "data": {
    "message": "Invalid login credentials",
    "name": "AuthApiError",
    "status": 400
  }
}

GET http://127.0.0.1:8000/profile


```bash
curl -X 'GET' \
  'http://127.0.0.1:8000/profile' \
  -H 'accept: application/json'
  • if after login return
  "status": "ok",
  "data": {
    "access_token": ".....",
    "data_user": {
      ............
    }
  }
  • else retern
{
  "status": "fail",
  "data": "Please login"
}

GET http://127.0.0.1:8000/logout

curl -X 'GET' \
  'http://127.0.0.1:8000/logout' \
  -H 'accept: application/json'
  • if success
{
  "status": "ok",
  "data": "Sign out successfully"
}