hii , how to store data when we try to signin-up [...
# support-questions-legacy
l
hii , how to store data when we try to signin-up [with google or any third party id] in custom database i tried Post signin / signup callbacks method [override_thirdpartypasswordless_apis() ] but couldn't get anything .
r
hey @lazzy_samurai
can you share code on how you have overriden?
l
def override_thirdpartypasswordless_apis(original_implementation: APIInterface, user_command_services=Depends(UserCommandService)): original_consume_code_post = original_implementation.consume_code_post async def consume_code_post(pre_auth_session_id: str, user_input_code: Union[str, None], device_id: Union[str, None], link_code: Union[str, None], api_options: PasswordlessAPIOptions, user_context: Dict[str, Any]): # First we call the original implementation of consume_code_post. response = await original_consume_code_post(pre_auth_session_id, user_input_code, device_id, link_code, api_options, user_context) # Post sign up response, we check if it was successful if isinstance(response, ConsumeCodePostOkResult): user_id = response.user.user_id email = response.user.email phone_number = response.user.phone_number third_party_info = response.user.third_party_info
# TODO: Post sign up logic if response.created_new_user: # print("Sing up new user: ") id = uuid.uuid4().__str__() # create user metadata in supertoken table. await update_user_metadata(user_id, { "id": id, "profilePic": "None", "firstname": "None", "lastname": "None", "email": email, "phone": phone_number, "gender": "None", "third_party_info": third_party_info.__str__(), "date_of_birth": "'1515-10-10'", }) print('Data --- > ', email, phone_number, third_party_info, third_party_info) # inserting data into user database . user = UserModel.create( id=id, user_id=user_id, firstname='None', lastname='None', gender='None', profilePic='None', email=email, phone=phone_number, third_party_info=third_party_info.__str__(), date_of_birth=datetime.strptime(str('1515-10-10'), "%Y-%m-%d").date(), ) async with async_session_factory() as session: session.add(user) await session.commit() await session.close() else: print('Data --- > ', email, phone_number, third_party_info) # print(third_party_info.id) # print("Sing in new user") return response original_implementation.consume_code_post = consume_code_post return original_implementation
r
ah ok. so that only overrides the passwordless sign up API. You also need to override the social login sign in up API
which should be
thirdparty_sign_in_up_post
function
the docs for that had this missing. Just updated it today
l
oh thank you so much 😇 ☺️
2 Views