To handle actions after the signup at https://supertokens.com/docs/thirdpartyemailpassword/common-cu...
b
To handle actions after the signup at https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/handling-signinup-success with
override_thirdpartyemailpassword_apis()
is it possible to get the user id? I would expect that
client_id
will have one, but it is
None
.
r
hey!
Can I see how you are overriding it?
b
Copy code
thirdpartyemailpassword.init(
      override=thirdpartyemailpassword.InputOverrideConfig(
        apis=override_thirdpartyemailpassword_apis
      ),
      providers=[
        Google(
          is_default=True,
          client_id=os.environ.get("GOOGLE_CLIENT_ID"),
          client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"),
        )
      ]
    ),
and then basically take the example from the website for
override_thirdpartyemailpassword_apis()
r
And whats the def of
override_thirdpartyemailpassword_apis
?
ah right
So you want to get the user ID after sign up right?
b
correct
r
In you custom
thirdparty_sign_in_up_post
function, it should be like:
Copy code
python
async def thirdparty_sign_in_up_post(provider: Provider, code: str, redirect_uri: str, client_id: Union[str, None], auth_code_response: Union[Dict[str, Any], None], api_options: ThirdPartyAPIOptions, user_context: Dict[str, Any]):
        # call the default behaviour as show below
        result = await original_thirdparty_sign_in_up_post(provider, code, redirect_uri, client_id, auth_code_response, api_options, user_context)
        
        if isinstance(result, ThirdPartySignInUpPostOkResult):
            if result.created_new_user:
                pass # TODO: some post sign up logic
            else:
                pass # TODO: some post sign in logic
        
        return result
In this, the
result
object will contain the user ID
b
ohhhh
how do I know how
result
will look like? Will it be
result.client_id
?
result.user.user_id
,
result.user.email
and so on.
b
ohhhh nice~
@rp_st that works indeed 😆
r
coool
b
will check the classes as well 🙂