11/22/2022, 12:02 PM
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 .


11/22/2022, 12:03 PM
hey @lazzySamurai
can you share code on how you have overriden?


11/22/2022, 12:06 PM
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 = 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( # print("Sing in new user") return response original_implementation.consume_code_post = consume_code_post return original_implementation