Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 931 Bytes

README.MD

File metadata and controls

52 lines (34 loc) · 931 Bytes

rest-api-with-auth-py in python

Run

uvicorn main:app --reload

Run in container

docker build -t rest-api-with-auth-py .

docker run --rm=true -p 8000:8000 --env-file=.config -e ENV=prod rest-api-with-auth-py

Environment variables

Set according to your Auth0 account

# .config
DOMAIN=
API_AUDIENCE=
ALGORITHMS=RS256
ISSUER=

API Endpoints

GET /

Returns a welcome message.

POST /

Create a new policy. Provide the following parameters in the request body:

{
  "name": "policy holder name",
  "phone": "phone number",
  "premium": "premium amount",
  "suminsured": "sum insured amount" 
}

This must be sent as an authenticated request. The JWT token must be sent in the Authorization header as a Bearer token. The JWT token must be valid, have scope write:policy and the audience must be as configured in the environment variable AUTH0_AUDIENCE.