Django Rest Auth - Key error on Email Confirmation
I am trying to setup email verification in DRF using rest-auth.
The registration works correctly and the verification email is sent. However, when going to the verification link I receive a key error.
What I understand is that means that this verification key doesn't exist, but I don't understand how to fix that given that the registration process was supposedly a success?
I have the following paths in my urls.py:
path('', include('rest_framework.urls', namespace='rest_framework')),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
path('registration/', RegisterView.as_view(), name='account_signup'),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
The following settings in my settings.py:
ACCOUNT_AUTHENTICATION_METHOD = 'email'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_REQUIRED = True
And this is a screenshot of the error I am getting:
Key error
django django-rest-framework django-rest-auth
add a comment |
I am trying to setup email verification in DRF using rest-auth.
The registration works correctly and the verification email is sent. However, when going to the verification link I receive a key error.
What I understand is that means that this verification key doesn't exist, but I don't understand how to fix that given that the registration process was supposedly a success?
I have the following paths in my urls.py:
path('', include('rest_framework.urls', namespace='rest_framework')),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
path('registration/', RegisterView.as_view(), name='account_signup'),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
The following settings in my settings.py:
ACCOUNT_AUTHENTICATION_METHOD = 'email'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_REQUIRED = True
And this is a screenshot of the error I am getting:
Key error
django django-rest-framework django-rest-auth
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28
add a comment |
I am trying to setup email verification in DRF using rest-auth.
The registration works correctly and the verification email is sent. However, when going to the verification link I receive a key error.
What I understand is that means that this verification key doesn't exist, but I don't understand how to fix that given that the registration process was supposedly a success?
I have the following paths in my urls.py:
path('', include('rest_framework.urls', namespace='rest_framework')),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
path('registration/', RegisterView.as_view(), name='account_signup'),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
The following settings in my settings.py:
ACCOUNT_AUTHENTICATION_METHOD = 'email'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_REQUIRED = True
And this is a screenshot of the error I am getting:
Key error
django django-rest-framework django-rest-auth
I am trying to setup email verification in DRF using rest-auth.
The registration works correctly and the verification email is sent. However, when going to the verification link I receive a key error.
What I understand is that means that this verification key doesn't exist, but I don't understand how to fix that given that the registration process was supposedly a success?
I have the following paths in my urls.py:
path('', include('rest_framework.urls', namespace='rest_framework')),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
path('registration/', RegisterView.as_view(), name='account_signup'),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
The following settings in my settings.py:
ACCOUNT_AUTHENTICATION_METHOD = 'email'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_REQUIRED = True
And this is a screenshot of the error I am getting:
Key error
django django-rest-framework django-rest-auth
django django-rest-framework django-rest-auth
edited Nov 15 '18 at 6:25
Amrsaeed
asked Nov 14 '18 at 17:34
AmrsaeedAmrsaeed
12
12
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28
add a comment |
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28
add a comment |
1 Answer
1
active
oldest
votes
This might be an old post but I just wanna share what I used as a solution in hopes that it helps someone else experiencing a similar issue.
# import the confirm_email views from allauth.accounts.views
from allauth.account.views import confirm_email
# once that's done, change your url view portion from
# VerifyEmailView.as_view() to the newly imported view
re_path(r"^account-confirm-email/(?P<key>[-:w]+)/$", confirm_email,
name="account_confirm_email"),
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305849%2fdjango-rest-auth-key-error-on-email-confirmation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This might be an old post but I just wanna share what I used as a solution in hopes that it helps someone else experiencing a similar issue.
# import the confirm_email views from allauth.accounts.views
from allauth.account.views import confirm_email
# once that's done, change your url view portion from
# VerifyEmailView.as_view() to the newly imported view
re_path(r"^account-confirm-email/(?P<key>[-:w]+)/$", confirm_email,
name="account_confirm_email"),
add a comment |
This might be an old post but I just wanna share what I used as a solution in hopes that it helps someone else experiencing a similar issue.
# import the confirm_email views from allauth.accounts.views
from allauth.account.views import confirm_email
# once that's done, change your url view portion from
# VerifyEmailView.as_view() to the newly imported view
re_path(r"^account-confirm-email/(?P<key>[-:w]+)/$", confirm_email,
name="account_confirm_email"),
add a comment |
This might be an old post but I just wanna share what I used as a solution in hopes that it helps someone else experiencing a similar issue.
# import the confirm_email views from allauth.accounts.views
from allauth.account.views import confirm_email
# once that's done, change your url view portion from
# VerifyEmailView.as_view() to the newly imported view
re_path(r"^account-confirm-email/(?P<key>[-:w]+)/$", confirm_email,
name="account_confirm_email"),
This might be an old post but I just wanna share what I used as a solution in hopes that it helps someone else experiencing a similar issue.
# import the confirm_email views from allauth.accounts.views
from allauth.account.views import confirm_email
# once that's done, change your url view portion from
# VerifyEmailView.as_view() to the newly imported view
re_path(r"^account-confirm-email/(?P<key>[-:w]+)/$", confirm_email,
name="account_confirm_email"),
answered Dec 24 '18 at 15:31
LehlohonoloLehlohonolo
265
265
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305849%2fdjango-rest-auth-key-error-on-email-confirmation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you try re_path(r'^account-confirm-email/(?P<key>[-:w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email')
– Monish K Nair
Nov 14 '18 at 23:51
I did try that. It's what I originally had, was just trying out using pk as per another online source. Forgot to add the right one in the post. It's updated now. It still doesn't work tho
– Amrsaeed
Nov 15 '18 at 6:28