Skip to content
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

How to use other otp provider like - msg91 #95

Open
raghvpip3 opened this issue Aug 24, 2021 · 10 comments
Open

How to use other otp provider like - msg91 #95

raghvpip3 opened this issue Aug 24, 2021 · 10 comments

Comments

@raghvpip3
Copy link

How to use other OTP provider like - msg91

@jaymes15
Copy link

@raghvpip3 were you able to get it working with Twilio?

@raghvpip3
Copy link
Author

yes, its working, but I am curious this package will work with other OTP provider or only support for twilio?

@jaymes15
Copy link

I was only able to get it to work with email

@jaymes15
Copy link

This the config I used

`PASSWORDLESS_AUTH = {

'PASSWORDLESS_AUTH_TYPES': ['EMAIL', 'MOBILE'],
'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS': DEFAULT_FROM_EMAIL,
'PASSWORDLESS_USER_MOBILE_FIELD_NAME': 'mobile',
'PASSWORDLESS_MOBILE_NOREPLY_NUMBER': \
    os.environ.get('TWILIO_PHONE_NUMBER'),
'PASSWORDLESS_EMAIL_TOKEN_HTML_TEMPLATE_NAME': "core/auth.html"

}`

@jaymes15
Copy link

any help would be appreciated

Screen Shot 2021-09-17 at 6 47 07 AM

@jaymes15
Copy link

got it
it work
Screen Shot 2021-09-17 at 7 24 03 AM
s

@dubesar
Copy link

dubesar commented Oct 1, 2021

@jaymes15 i am getting the same error, can you share your configs?

@jaymes15
Copy link

jaymes15 commented Oct 2, 2021

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = False
EMAIL_HOST = os.environ.get('EMAIL_HOST')
EMAIL_PORT = 587
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

PASSWORDLESS_AUTH = {

'PASSWORDLESS_AUTH_TYPES': ['EMAIL', 'MOBILE'],
'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS': DEFAULT_FROM_EMAIL,
'PASSWORDLESS_USER_MOBILE_FIELD_NAME': 'mobile',
'PASSWORDLESS_MOBILE_NOREPLY_NUMBER': \
    os.environ.get('TWILIO_PHONE_NUMBER'),
'PASSWORDLESS_USER_MARK_MOBILE_VERIFIED': True,
'PASSWORDLESS_USER_MOBILE_VERIFIED_FIELD_NAME': 'mobile_verified',
'PASSWORDLESS_USER_MARK_EMAIL_VERIFIED': True,
'PASSWORDLESS_USER_EMAIL_VERIFIED_FIELD_NAME': 'email_verified',

'PASSWORDLESS_EMAIL_TOKEN_HTML_TEMPLATE_NAME': "core/auth.html"

}

@bigfat130397
Copy link

bigfat130397 commented Jan 11, 2022

This is possible by mentioning a specific function in configuration, just replace the below value to your function name and it will work

'PASSWORDLESS_SMS_CALLBACK': 'drfpasswordless.utils.send_sms_with_callback_token'

for example in my project with app named testapp in views.py my customized function named send_sms_code then my value would be:

'PASSWORDLESS_SMS_CALLBACK': 'testapp.views.send_sms_code'

@jaymes15
Copy link

@bigfat130397 answer is correct
Tried and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants