Hey guys, I am using `supertokens-python==0.8.2` w...
# support-questions
e
Hey guys, I am using
supertokens-python==0.8.2
with
Django==4.0.6
and resend code is not working for passwordless. Is it a known issue for python SDK version I am using? It is a POST request from frontend to the URL
signinup/code/resend
with
preAuthSessionId
and
deviceId
payload. The response says
"status": "OK"
with 200 status, and the code is not being delivered. I cannot see any logs on the backend that indicate code resend attempt.
We have self-hosted
supertokens-core==v3.14.0
r
Hey @execreate let us have a look. There is no such known issue.
k
Can you please share your supertokens init snippet?
e
Sure, one moment
Copy code
python
from supertokens_python import init, InputAppInfo, SupertokensConfig
from supertokens_python.recipe import passwordless, session
from supertokens_python.recipe.passwordless import ContactPhoneOnlyConfig

from apps.mysupertokens.otp_delivery import async_send_text_message
from apps.mysupertokens.overrides import override_functions


def init_supertokens(site_url,
                     website_domain,
                     website_base_path,
                     connection_uri,
                     api_key):
    # ensure cookie domain is '.example.com' if api is hosted on a subdomain
    cookie_domain = site_url.removeprefix("http://").removeprefix("https://")
    if len(cookie_domain.split(".")) > 2:
        cookie_domain = "." + ".".join(cookie_domain.split(".")[-2:])

    init(
        app_info=InputAppInfo(
            app_name="medhub",
            api_domain=site_url,
            api_base_path="/auth",
            website_domain=website_domain,
            website_base_path=website_base_path,
        ),
        supertokens_config=SupertokensConfig(
            connection_uri=connection_uri,
            api_key=api_key,
        ),
        framework='django',
        recipe_list=[
            session.init(
                override=session.InputOverrideConfig(functions=override_functions),
                cookie_domain=cookie_domain,
            ),
            passwordless.init(
                flow_type="USER_INPUT_CODE",
                contact_config=ContactPhoneOnlyConfig(
                    create_and_send_custom_text_message=async_send_text_message
                )
            )
        ],
        mode='wsgi',
    )
override_functions
override
create_new_session
to ensure that access token contains user roles;
r
Does the
async_send_text_message
function get called when you click on the resend button?
e
No. I know it for sure, because we have a golang telegram bot service which delivers OTPs. It does not get called on resend.
r
I see. But it gets sent during the initial login?
e
Yes, it gets called and OTP is delivered immediately
on initial login
r
I see.
Can you upgrade to a newer version of the SDK? This issue might have been solved already.
e
I thought so too. I'll try to upgrade SDK version on our staging env and let you know if the issue is resolved.
It's gonna take an hour or so
k
Sure. Keep us posted.
e
Resend code works just fine with
supertokens-python==0.10.1
🎉
2 Views