Skip to content

[auth0-fastapi] Adds scopes to profile endpoint example #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/auth0_fastapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,14 @@ from auth0_fastapi.auth.auth_client import AuthClient


config = Auth0Config(
domain="YOUR_AUTH0_DOMAIN", # e.g., "dev-1234abcd.us.auth0.com"
domain="YOUR_AUTH0_DOMAIN", # e.g., "dev-1234abcd.us.auth0.com"
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
app_base_url="http://localhost:3000", # or your production URL
secret="YOUR_SESSION_SECRET"
secret="YOUR_SESSION_SECRET",
authorization_params={
"scope": "openid profile", # required get the user information from Auth0
}
)

auth_client = AuthClient(config)
Expand All @@ -230,6 +233,7 @@ async def profile(request: Request, response: Response, session=Depends(auth_cli

> [!IMPORTANT]
> The above is to protect server-side rendering routes by the means of a session, and not API routes using a bearer token.
> The `authorization_params` passing the `scope` is used in to retrieve the user information from Auth0. Can be omitted if you don't need the user information.


#### Requesting an Access Token to call an API
Expand Down