def sign_in_with_email_link(): action_code_settings = init_action_code_settings() # [START sign_in_with_email_link] email = '*****@*****.**' link = auth.generate_sign_in_with_email_link(email, action_code_settings) # Construct email from a template embedding the link, and send # using a custom SMTP server. send_custom_email(email, link)
def test_email_signin_with_settings(self, user_mgt_app): _, recorder = _instrument_user_manager(user_mgt_app, 200, '{"oobLink":"https://testlink"}') link = auth.generate_sign_in_with_email_link('*****@*****.**', action_code_settings=MOCK_ACTION_CODE_SETTINGS, app=user_mgt_app) request = json.loads(recorder[0].body.decode()) assert link == 'https://testlink' assert request['requestType'] == 'EMAIL_SIGNIN' self._validate_request(request, MOCK_ACTION_CODE_SETTINGS)
def test_email_sign_in_with_settings(new_user_email_unverified, api_key): action_code_settings = auth.ActionCodeSettings(ACTION_LINK_CONTINUE_URL) link = auth.generate_sign_in_with_email_link(new_user_email_unverified.email, action_code_settings=action_code_settings) assert isinstance(link, str) query_dict = _extract_link_params(link) assert query_dict['continueUrl'] == ACTION_LINK_CONTINUE_URL oob_code = query_dict['oobCode'] id_token = _sign_in_with_email_link(new_user_email_unverified.email, oob_code, api_key) assert id_token is not None and len(id_token) > 0 assert auth.get_user(new_user_email_unverified.uid).email_verified