flixoflax
08/15/2022, 8:54 AMdoesSessionExist
and getRedirectionPath
. It works like a charm with email and password, and also with the Facebook Provider. However, it doesn't seem to work with the Google Provider. Every time I try to sign in or up with the Google provider I get redirected to my dashboard not the set-username route. If I refresh the page supertokens instantly remembers that there shouldnt be a session and redirects me to the set-username route (The only difference I see is that you do not need to verify the Google email address, while you need to verify the Facebook email, which should be handled by a logic in the doesSessionExist where we first check the atp and then check the email). Seems like a strange thing to me...rp_st
08/15/2022, 8:56 AMrp_st
08/15/2022, 8:57 AMflixoflax
08/15/2022, 8:57 AMrp_st
08/15/2022, 9:02 AMaccessTokenPayload.isUsernameSet
post facebook sign in vs post google sign in?flixoflax
08/15/2022, 9:03 AMflixoflax
08/15/2022, 9:03 AMrp_st
08/15/2022, 9:03 AMflixoflax
08/15/2022, 9:03 AMflixoflax
08/15/2022, 9:03 AMflixoflax
08/15/2022, 9:07 AMisEmailVerified: true // this depends if its google or facebook.
isUsernameSet: false
username: ""
rp_st
08/15/2022, 9:11 AMgetRedirectionURL
function. Can you add console logs to that and see where the execution flows in case of google sign in vs facebook sign in? I think the issue lies in that function's customisation.flixoflax
08/15/2022, 9:17 AMflixoflax
08/15/2022, 9:17 AMflixoflax
08/15/2022, 9:17 AMflixoflax
08/15/2022, 9:17 AMrp_st
08/15/2022, 9:18 AM/
?flixoflax
08/15/2022, 9:18 AMflixoflax
08/15/2022, 9:18 AMflixoflax
08/15/2022, 9:19 AMflixoflax
08/15/2022, 9:19 AMflixoflax
08/15/2022, 9:19 AMrp_st
08/15/2022, 9:20 AMflixoflax
08/15/2022, 9:20 AMflixoflax
08/15/2022, 9:20 AMrp_st
08/15/2022, 9:20 AMflixoflax
08/15/2022, 9:20 AMporcellus
08/15/2022, 9:49 AMdoesSessionExist
, isEmailVerified
, getRedirectionURL
and onHandleEvent
(with context.action
in the last two)flixoflax
08/15/2022, 10:08 AMflixoflax
08/15/2022, 10:11 AMdoesSessionExist
(oI returns false) - onHandleEvent
(context.action is success and its a newUser) - isEmailVerified
- getRedirectionURL
(only for facebook)porcellus
08/15/2022, 10:27 AMgetRedirectionURL
gets the VERIFY_EMAIL
action for facebook, right?flixoflax
08/15/2022, 10:32 AMporcellus
08/15/2022, 10:33 AMgetRedirectionURL
is called with a context (the only param), that has an action prop.flixoflax
08/15/2022, 10:34 AMflixoflax
08/15/2022, 10:41 AMporcellus
08/15/2022, 11:02 AMgetRedirectionURL
is not applied to the thirdparty
recipe properly (as a sub-recipe of thirdpartyemailpassword
. I see no reason it should be like that, I'll investigate and get back to you in a bit.porcellus
08/15/2022, 11:03 AMrp_st
08/15/2022, 11:04 AMporcellus
08/15/2022, 12:42 PMflixoflax
08/15/2022, 12:56 PMflixoflax
08/16/2022, 4:49 AMrp_st
08/16/2022, 4:52 AMporcellus
08/16/2022, 8:49 AMflixoflax
08/16/2022, 1:12 PMrp_st
08/16/2022, 1:13 PMrp_st
08/16/2022, 1:13 PMporcellus
08/16/2022, 8:38 PMdoesSessionExist
override is only called during full-page reloads. If we create/refresh a session, we set the value to true in the context while handling the event without calling doesSessionExist
. This explains why it "remembers" that it's not supposed to have a session after a refresh.
- getRedirectionPath
is only called in your app by the ThirdPartyEmailPasswordAuth
, if it detects that the user has no session or is missing email verification. Since you always have a session after sign-in, it explains the issue with third-party providers that mark the email address as verified.
My recommendation:
Replace ThirdPartyEmailPasswordAuth
with your own component that uses useSessionContext
and does the email verification, user name, and session checking and handles redirects. This way, you can remove the getRedirectionURL
, and doesSessionExist
overrides, which should be a bit cleaner in general.porcellus
08/16/2022, 8:40 PM