-
Notifications
You must be signed in to change notification settings - Fork 338
Added snippets for email action links API #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3621162
Added snippets for email action links API
hiranya911 35e2701
Fixing a lint error; Fixing a regression caused by https://github.com…
hiranya911 335133b
Fixing order of exported methods
hiranya911 606a3fe
Applying feedback from docs team; Updating snippets based on code rev…
hiranya911 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -587,6 +587,58 @@ def import_without_password(): | |
print('Error importing users:', error) | ||
# [END import_without_password] | ||
|
||
def init_action_code_settings(): | ||
# [START init_action_code_settings] | ||
action_code_settings = auth.ActionCodeSettings( | ||
url='https://www.example.com/checkout?cartId=1234', | ||
handle_code_in_app=True, | ||
ios_bundle_id='com.example.ios', | ||
android_package_name='com.example.android', | ||
android_install_app=True, | ||
android_minimum_version='12', | ||
dynamic_link_domain='coolapp.page.link', | ||
) | ||
# [END init_action_code_settings] | ||
return action_code_settings | ||
|
||
def password_reset_link(): | ||
action_code_settings = init_action_code_settings() | ||
display_name = 'Example User' | ||
# [START password_reset_link] | ||
email = '[email protected]' | ||
link = auth.generate_password_reset_link(email, action_code_settings) | ||
# Construct password reset email template, embed the link and send | ||
hiranya911 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# using custom SMTP server. | ||
send_custom_email(email, display_name, link) | ||
# [END password_reset_link] | ||
|
||
def email_verification_link(): | ||
action_code_settings = init_action_code_settings() | ||
display_name = 'Example User' | ||
# [START email_verification_link] | ||
email = '[email protected]' | ||
link = auth.generate_email_verification_link(email, action_code_settings) | ||
# Construct email verification template, embed the link and send | ||
# using custom SMTP server. | ||
send_custom_email(email, display_name, link) | ||
# [END email_verification_link] | ||
|
||
def sign_in_with_email_link(): | ||
action_code_settings = init_action_code_settings() | ||
display_name = 'Example User' | ||
# [START sign_in_with_email_link] | ||
email = '[email protected]' | ||
link = auth.generate_sign_in_with_email_link(email, action_code_settings) | ||
# Construct sign-in with email link template, embed the link and send | ||
# using custom SMTP server. | ||
send_custom_email(email, display_name, link) | ||
# [END sign_in_with_email_link] | ||
|
||
def send_custom_email(email, display_name, link): | ||
del email | ||
del display_name | ||
del link | ||
|
||
initialize_sdk_with_service_account() | ||
initialize_sdk_with_application_default() | ||
#initialize_sdk_with_refresh_token() | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.