Skip to content
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

feat: oauth provider #549

Open
wants to merge 39 commits into
base: 0.26
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e2f316f
fix: files for oauth2 providers
sattvikc Nov 11, 2024
59109a8
fix: interface
sattvikc Nov 12, 2024
f577523
fix: oauth2 interfaces
sattvikc Nov 12, 2024
6479bda
fix: update recipe.py
sattvikc Nov 26, 2024
94fc82d
fix: login request impl
sattvikc Nov 26, 2024
1fe7e51
fix: query params for put request
sattvikc Nov 26, 2024
8f96467
fix: consent request
sattvikc Nov 26, 2024
804121d
fix: more impl
sattvikc Nov 26, 2024
22ab47b
fix: more impl
sattvikc Nov 27, 2024
e7fe99c
Merge branch '0.26' into feat/oauth-provider
sattvikc Nov 29, 2024
e776828
fix: recipe impl
sattvikc Nov 29, 2024
f462284
fix: recipe impl
sattvikc Nov 29, 2024
c83ef6f
fix: validate_oauth2_access_token
sattvikc Nov 29, 2024
2f7e994
fix: authorization
sattvikc Nov 29, 2024
00a6128
fix: token exchange
sattvikc Nov 29, 2024
6f6b6e4
fix: frontend redirection url
sattvikc Nov 29, 2024
07868f1
fix: revoke token
sattvikc Nov 29, 2024
4386cb8
fix: end session
sattvikc Nov 29, 2024
2c06ffb
fix: api stubs
sattvikc Dec 2, 2024
eae13cc
fix: api structures and lint fixes
sattvikc Dec 2, 2024
c4c8d11
fix: remaining type fixes
sattvikc Dec 2, 2024
a1dff9d
fix: end session
sattvikc Dec 3, 2024
1e35b54
fix: api endpoints
sattvikc Dec 3, 2024
79194a4
fix: remaining apis
sattvikc Dec 4, 2024
fbee6d6
fix: remaining impl
sattvikc Dec 4, 2024
9eb33ce
fix: typing
sattvikc Dec 4, 2024
e3d1287
fix: type and lint
sattvikc Dec 10, 2024
3041401
fix: types, exposed functions and cyclic import
sattvikc Dec 11, 2024
34e96da
fix: backend sdk tests
sattvikc Dec 12, 2024
d8dd684
fix: default recipes and fixes for test
sattvikc Dec 12, 2024
fc42477
fix: tests
sattvikc Dec 12, 2024
724c97b
fix: tests
sattvikc Dec 12, 2024
dae1204
fix: tests
sattvikc Dec 12, 2024
213b9fe
fix: tests
sattvikc Dec 12, 2024
92a7a0b
fix: tests
sattvikc Dec 13, 2024
91926ae
fix: tests
sattvikc Dec 13, 2024
632b5dd
fix: openid and cookies
sattvikc Dec 17, 2024
2685c31
fix: roles and permissions for oauth2
sattvikc Dec 17, 2024
0226085
fix: auth react tests
sattvikc Dec 17, 2024
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
Prev Previous commit
Next Next commit
fix: tests
sattvikc committed Dec 12, 2024
commit dae12043cdb90752067d7e9ec054a3f559e72ef0
2 changes: 1 addition & 1 deletion supertokens_python/recipe/oauth2provider/api/auth.py
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ async def auth_get(
httponly=morsel.get("httponly", True),
expires=datetime.strptime(morsel.get("expires", ""), "%a, %d %b %Y %H:%M:%S %Z").timestamp() * 1000, # type: ignore
path=morsel.get("path", "/"),
samesite=morsel.get("samesite", "lax"),
samesite=morsel.get("samesite", "lax").lower(),
)
return api_options.response.redirect(response.redirect_to)
elif isinstance(response, ErrorOAuth2Response):
2 changes: 1 addition & 1 deletion supertokens_python/recipe/oauth2provider/api/login.py
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ async def login(
httponly=morsel.get("httponly", True),
expires=datetime.strptime(morsel.get("expires", ""), "%a, %d %b %Y %H:%M:%S %Z").timestamp() * 1000, # type: ignore
path=morsel.get("path", "/"),
samesite=morsel.get("samesite", "lax"),
samesite=morsel.get("samesite", "lax").lower(),
)

return send_200_response(
Original file line number Diff line number Diff line change
@@ -310,14 +310,16 @@ async def authorization(

payloads = {"idToken": id_token, "accessToken": access_token}

request_body = {
"params": {**params, "scope": " ".join(scopes)},
"iss": await OpenIdRecipe.get_issuer(user_context),
"session": payloads,
}
if cookies is not None:
request_body["cookies"] = cookies
resp = await self.querier.send_post_request(
NormalisedURLPath("/recipe/oauth/auth"),
{
"params": {**params, "scope": " ".join(scopes)},
"iss": await OpenIdRecipe.get_issuer(user_context),
"cookies": cookies,
"session": payloads,
},
request_body,
user_context,
)