Skip to content

Commit aa7953c

Browse files
authored
fix: generate_fake_email param ordering (#499)
1 parent 2ddc24a commit aa7953c

File tree

5 files changed

+69
-3
lines changed

5 files changed

+69
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11+
## [0.20.1] - 2024-05-10
12+
13+
- Fixes parameter mismatch in generating fake email
14+
1115
## [0.20.0] - 2024-05-08
1216

1317
- 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.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
setup(
8585
name="supertokens_python",
86-
version="0.20.0",
86+
version="0.20.1",
8787
author="SuperTokens",
8888
license="Apache 2.0",
8989
author_email="[email protected]",

supertokens_python/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from __future__ import annotations
1515

1616
SUPPORTED_CDI_VERSIONS = ["3.0"]
17-
VERSION = "0.20.0"
17+
VERSION = "0.20.1"
1818
TELEMETRY = "/telemetry"
1919
USER_COUNT = "/users/count"
2020
USER_DELETE = "/user/remove"

supertokens_python/recipe/thirdparty/api/implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def sign_in_up_post(
9191
if provider.config.generate_fake_email is not None:
9292
user_info.email = UserInfoEmail(
9393
email=await provider.config.generate_fake_email(
94-
user_info.third_party_user_id, tenant_id, user_context
94+
tenant_id, user_info.third_party_user_id, user_context
9595
),
9696
is_verified=True,
9797
)

tests/thirdparty/test_thirdparty.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,65 @@ async def test_signinup_android_without_redirect_uri(
328328
)
329329
assert res.status_code == 200
330330
assert res.json()["status"] == "OK"
331+
332+
333+
async def test_signinup_generating_fake_email(
334+
fastapi_client: TestClient, mocker: MockerFixture
335+
):
336+
mocker.patch(
337+
"supertokens_python.recipe.thirdparty.providers.custom.get_supertokens_user_info_result_from_raw_user_info",
338+
return_value=UserInfo(
339+
"customid",
340+
None,
341+
RawUserInfoFromProvider({}, {}),
342+
),
343+
)
344+
st_init_args = {
345+
**st_init_common_args,
346+
"recipe_list": [
347+
session.init(),
348+
thirdpartyemailpassword.init(
349+
providers=[
350+
ProviderInput(
351+
config=ProviderConfig(
352+
third_party_id="custom",
353+
clients=[
354+
ProviderClientConfig(
355+
client_id="test",
356+
client_secret="test-secret",
357+
scope=["profile", "email"],
358+
client_type="android",
359+
),
360+
],
361+
authorization_endpoint="https://example.com/oauth/authorize",
362+
authorization_endpoint_query_params={
363+
"response_type": "token", # Changing an existing parameter
364+
"response_mode": "form", # Adding a new parameter
365+
"scope": None, # Removing a parameter
366+
},
367+
token_endpoint="https://example.com/oauth/token",
368+
require_email=False,
369+
),
370+
)
371+
]
372+
),
373+
],
374+
}
375+
init(**st_init_args) # type: ignore
376+
start_st()
377+
378+
res = fastapi_client.post(
379+
"/auth/signinup",
380+
json={
381+
"thirdPartyId": "custom",
382+
"clientType": "android",
383+
"oAuthTokens": {
384+
"access_token": "accesstoken",
385+
"id_token": "idtoken",
386+
},
387+
},
388+
)
389+
assert res.status_code == 200
390+
res_json = res.json()
391+
assert res_json["status"] == "OK"
392+
assert res_json["user"]["email"] == "[email protected]"

0 commit comments

Comments
 (0)