Open raghvpip3 opened 3 years ago
@raghvpip3 were you able to get it working with Twilio?
yes, its working, but I am curious this package will work with other OTP provider or only support for twilio?
I was only able to get it to work with email
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"
}`
any help would be appreciated
got it it work
s
@jaymes15 i am getting the same error, can you share your configs?
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"
}
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'
@bigfat130397 answer is correct Tried and it works
How to use other OTP provider like - msg91