2
votes

In my Django-rest-framework backed project, I am using Djoser in my project for authentication. Registration and login works fine for me. I use JWT token also. Now My problem is with the activation link that is send to the registered email. It creates an email, prints in my console with an activation link but when I click, it shows - email

My settings is as -

EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_PASSWORD = 'asdasd'
EMAIL_HOST_USER = '[email protected]'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

How to fix this thing? Can anyone please let me know, what am I doing wrong?

2

2 Answers

2
votes

First of all, clean the djoser settings, in the settings.py, set the 'ACTIVATION_URL': '/activate/{uid}/{token}'. And from the djoser docs it says that this endpoint is not a URL which will be directly exposed to your users - you should provide site in your frontend application (configured by ACTIVATION_URL) which will send POST request to activate endpoint. So you need to post to /activate/ with the data(uid and token) to activate the account, for example if you want to curl,that will be curl -X POST http://localhost:8000/activate/ -d 'uid=youruid*token=yourtoken'. The url proivded in the emails is a link which you need to create in the frontend and somehow in that page you need to post the uid and token to /activate/.

0
votes

The error says the URL doesn't exist. Check the url.py in which you have included the URL for djoser.