aaronn / django-rest-framework-passwordless

Passwordless Auth for Django REST Framework
MIT License
708 stars 154 forks source link

Mobile auth not working? #137

Closed jfornear closed 9 months ago

jfornear commented 9 months ago

When I try to get an auth token for a valid mobile number like this:

curl -X POST -d "mobile=+14151234567" localhost:8000/auth/mobile/

I get this error:

{"mobile":["Mobile number must be entered in the format: '+999999999'. Up to 15 digits allowed."]}%

Email works fine.

I think this error could be improved to be more clear what the issue is.

jfornear commented 9 months ago

I think I need to set up a custom user model.

jfornear commented 9 months ago

I added the custom user model and now get this error:

Server response data: {"detail": "Unable to send you a login code. Try again later."}

I think I need to wait for my Twilio campaign to be approved and look at my Twilio config.

jfornear commented 9 months ago

I added this to my settings.py since I'm using dotenv locally:

os.environ['TWILIO_ACCOUNT_SID'] = config['TWILIO_ACCOUNT_SID']
os.environ['TWILIO_AUTH_TOKEN'] = config['TWILIO_AUTH_TOKEN']

And it seems to be working:

{"detail": "We texted you a login code."}

I see the codes in my database, but I'm not getting any texts on my phone yet.

jfornear commented 9 months ago

Twilio logs show this error:

(Error: 30034) US A2P 10DLC - Message from an Unregistered Number

From the docs:

You are sending messages to the US using a US 10DLC number that is not associated with an approved A2P 10DLC Campaign.

I think I just need to wait for my campaign to be approved by Twilio.