Skip to content

fix: generate_fake_email param ordering #499

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 10, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.20.1] - 2024-05-10

- Fixes parameter mismatch in generating fake email

## [0.20.0] - 2024-05-08

- Added `older_cookie_domain` config option in the session recipe. This will allow users to clear cookies from the older domain when the `cookie_domain` is changed.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

setup(
name="supertokens_python",
version="0.20.0",
version="0.20.1",
author="SuperTokens",
license="Apache 2.0",
author_email="[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from __future__ import annotations

SUPPORTED_CDI_VERSIONS = ["3.0"]
VERSION = "0.20.0"
VERSION = "0.20.1"
TELEMETRY = "/telemetry"
USER_COUNT = "/users/count"
USER_DELETE = "/user/remove"
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/recipe/thirdparty/api/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def sign_in_up_post(
if provider.config.generate_fake_email is not None:
user_info.email = UserInfoEmail(
email=await provider.config.generate_fake_email(
user_info.third_party_user_id, tenant_id, user_context
tenant_id, user_info.third_party_user_id, user_context
),
is_verified=True,
)
Expand Down
62 changes: 62 additions & 0 deletions tests/thirdparty/test_thirdparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,65 @@ async def test_signinup_android_without_redirect_uri(
)
assert res.status_code == 200
assert res.json()["status"] == "OK"


async def test_signinup_generating_fake_email(
fastapi_client: TestClient, mocker: MockerFixture
):
mocker.patch(
"supertokens_python.recipe.thirdparty.providers.custom.get_supertokens_user_info_result_from_raw_user_info",
return_value=UserInfo(
"customid",
None,
RawUserInfoFromProvider({}, {}),
),
)
st_init_args = {
**st_init_common_args,
"recipe_list": [
session.init(),
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="custom",
clients=[
ProviderClientConfig(
client_id="test",
client_secret="test-secret",
scope=["profile", "email"],
client_type="android",
),
],
authorization_endpoint="https://example.com/oauth/authorize",
authorization_endpoint_query_params={
"response_type": "token", # Changing an existing parameter
"response_mode": "form", # Adding a new parameter
"scope": None, # Removing a parameter
},
token_endpoint="https://example.com/oauth/token",
require_email=False,
),
)
]
),
],
}
init(**st_init_args) # type: ignore
start_st()

res = fastapi_client.post(
"/auth/signinup",
json={
"thirdPartyId": "custom",
"clientType": "android",
"oAuthTokens": {
"access_token": "accesstoken",
"id_token": "idtoken",
},
},
)
assert res.status_code == 200
res_json = res.json()
assert res_json["status"] == "OK"
assert res_json["user"]["email"] == "[email protected]"
Loading