Skip to content

Commit e88d130

Browse files
committed
Refactor the /auth to /authorize
1 parent a438ad4 commit e88d130

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

docs/integration/integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ choices, this kind of solution gives developers freedom.
5050
## Router
5151

5252
Router defines the endpoints that are used for the authentication and logout. The authentication is done by
53-
the `/oauth2/{provider}/auth` endpoint and the logout is done by the `/oauth2/logout` endpoint. The `{provider}` is the
54-
name of the provider that is going to be used for the authentication and coincides with the `name` attribute of
53+
the `/oauth2/{provider}/authorize` endpoint and the logout is done by the `/oauth2/logout` endpoint. The `{provider}` is
54+
the name of the provider that is going to be used for the authentication and coincides with the `name` attribute of
5555
the `backend` provided to the certain `OAuth2Client`.
5656

5757
```python

docs/references/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ the [#19](https://github.com/pysnippet/fastapi-oauth2/issues/19) issue.
2222

2323
## CSRF protection
2424

25-
CSRF protection is enabled by default which means when the user opens the `/oauth2/{provider}/auth` endpoint it
25+
CSRF protection is enabled by default which means when the user opens the `/oauth2/{provider}/authorize` endpoint it
2626
redirects to the authorization endpoint of the IDP with an autogenerated `state` parameter and saves it in the session
2727
storage. After authorization, when the `/oauth2/{provider}/token` callback endpoint gets called with the
2828
provided `state`, the `oauthlib` validates it and then redirects to the `redirect_uri`.

docs/references/tutorials.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ generated the client ID and secret to configure your `OAuth2Middleware` with at
2222
3. Set the `redirect_uri` of your application that you have also configured in the IDP.
2323
4. Add the middleware and include the router to your application as shown in the [integration](/integration/integration)
2424
section.
25-
5. Open the `/oauth2/{provider}/auth` endpoint on your browser and test the authentication flow. Check out
25+
5. Open the `/oauth2/{provider}/authorize` endpoint on your browser and test the authentication flow. Check out
2626
the [router](/integration/integration#router) for the `{provider}` variable.
2727

2828
Once the authentication is successful, the user will be redirected to the `redirect_uri` and the `request.user` will

examples/demonstration/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Simulate Login
2323
</a>
2424
{% for provider in request.auth.clients %}
25-
<a href="/oauth2/{{ provider }}/auth" style="display: flex; align-items: center;">
25+
<a href="/oauth2/{{ provider }}/authorize" style="display: flex; align-items: center;">
2626
<img
2727
alt="{{ provider }} icon"
2828
src="/static/{{ provider }}.svg"

src/fastapi_oauth2/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
router = APIRouter(prefix="/oauth2")
66

77

8-
@router.get("/{provider}/auth")
8+
@router.get("/{provider}/authorize")
99
def authorize(request: Request, provider: str):
1010
if request.auth.ssr:
1111
return request.auth.clients[provider].authorization_redirect(request)

tests/test_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@pytest.mark.anyio
66
async def test_auth_redirect(get_app):
77
async with AsyncClient(app=get_app(), base_url="http://test") as client:
8-
response = await client.get("/oauth2/github/auth")
8+
response = await client.get("/oauth2/github/authorize")
99
assert response.status_code == 303 # Redirect
1010

1111

0 commit comments

Comments
 (0)