(emailpassword & session - react - python-flask) e...
# support-questions-legacy
j
(emailpassword & session - react - python-flask) email verification failing
My email verification setup fails w/ a 404 on the last page (when I click the verification link in the email supertokens sends). I turned on the logs and here's what I see:
Copy code
com.supertokens {"t": "2022-09-11T16:32:19.303Z", "sdkVer": "0.10.4", "message": "middleware: Started", "file": "supertokens.py:534"}

com.supertokens {"t": "2022-09-11T16:32:19.303Z", "sdkVer": "0.10.4", "message": "middleware: requestRID is: None", "file": "supertokens.py:547"}

com.supertokens {"t": "2022-09-11T16:32:19.303Z", "sdkVer": "0.10.4", "message": "middleware: Checking recipe ID for match: emailpassword", "file": "supertokens.py:571"}

com.supertokens {"t": "2022-09-11T16:32:19.303Z", "sdkVer": "0.10.4", "message": "middleware: Checking recipe ID for match: session", "file": "supertokens.py:571"}

com.supertokens {"t": "2022-09-11T16:32:19.303Z", "sdkVer": "0.10.4", "message": "middleware: Not handling because no recipe matched", "file": "supertokens.py:584"}

10.0.0.115 - - [11/Sep/2022 09:32:19] "GET /auth/verify-email?token=ZWU3YzUwYzdjYjU2MWZiZjdmMzJjMGIwYzMzODI2NTM3ZTc3YjA3ZjZlYTgxYTliMzMwZGQzNGM0NTUwNzVhYzNkYzZhOTVkN2E0MDZjMmYxMGUxYWVhYWIwODNkMzJk&rid=emailpassword HTTP/1.1" 404 -
Looking closer at the python SDK / it looks like it expects either a
rid
set in the header of the
GET /auth/verify-email
request or that this request shape matches an declared api handled by one of the recipes I'm using. Neither appear to be true.
r
hmm. this is strange. Cause there is a query param in the link
rid=emailpassword
j
Yeah I was wondering about that. That shouldn't be a url param right?
r
this is supposed to open on the frontend app.
and then the frontend sends a request to the backend with the token and the
rid
header
what values have you set for apiDomain and websiteDomain?
j
hmm maybe a misconfig on the frontend
init
call?
Checking
r
this would happen if you misconfig the backend.
j
Frontend:
Copy code
SuperTokens.init({
  appInfo: {
    appName: 'Mogara',
    apiDomain: 'http://10.0.0.115:5000',
    websiteDomain: 'http://10.0.0.115:5000',
    apiBasePath: '/auth',
    websiteBasePath: '/auth',
  },
  recipeList: [
    EmailPassword.init({
      emailVerificationFeature: {
        mode: 'REQUIRED',
      },
    }),
    Session.init(),
  ],
});
Backend:
Copy code
init(
    app_info=InputAppInfo(
        app_name="Mogara",
        api_domain=API_DOMAIN,  # http://10.0.0.115:5000
        website_domain=WEBSITE_DOMAIN,  # http://10.0.0.115:5000
        api_base_path="/auth",
        website_base_path="/auth"
    ),
    supertokens_config=SupertokensConfig(
        connection_uri=SUPERTOKENS_CONNECTION_URI,
        api_key=SUPERTOKENS_API_KEY,
    ),
    framework='flask',
    recipe_list=[
        emailpassword.init(),
        session.init(), 
    ]
)
(Testing locally right now)
r
huh.. so the apiDomain and websiteDomain have the same values?
in that case, you should change one of the base paths - either the apiBasePath or the websiteBasePath
and change them such that neither are a subset of another
for example, apiBasePath can be
/supertokens
and
websiteBasePath
can be
/auth
and then try again
(and make sure to change on frontend & backend)
j
ahh kk. (for my own edification): why would a name collision cause issues?
r
cause now if you open the email verification link, supertokens will treat this as an API request (as you are seeing) yielding a 404
cause the URL matches the apiDomain and apiBasePath
you can even make the ports different, and it should work
j
Found a related issue to prevent this failure mode: https://github.com/supertokens/supertokens-core/issues/172
It's looking like the domains must be different for this to work? Making
apiBasePath
and
websiteBasePath
different (in the way you suggested) doesn't appear to solve it.
As a side note, thank you team for building this product! It's been a treat to integrate so quickly (baring this one tiny issue).
r
thanks for the kind words 🙂
It also depends on how you have setup your frontend. What's the error?
j
(headsup AFK): It's the same stack trace as before ^. My frontend / backend API are both served by a single flask API. What specific dimensions of the frontend setup matter in this case?
r
that the frontend app is served on the websiteBasePath and that the frontend SDK handles that route.