Giter Site home page Giter Site logo

Reverse for 'socialaccount_signup' not found. 'socialaccount_signup' is not a valid view function or pattern name. about nextjswithdrfexample HOT 5 CLOSED

mahieyin-rahmun avatar mahieyin-rahmun commented on May 19, 2024
Reverse for 'socialaccount_signup' not found. 'socialaccount_signup' is not a valid view function or pattern name.

from nextjswithdrfexample.

Comments (5)

mahieyin-rahmun avatar mahieyin-rahmun commented on May 19, 2024 3

A thing to note is that: url(r"^accounts", include("allauth.urls")), this line should be put in the urls.py of the django project and not a django app, make sure you have done this correctly.

I came to the full solution using Chrome Dev Tool's network tab. When this "account clash" happens, DRF actually sends back a response but we're too focused on the error in the DRF server terminal. Here's the code snippet from my other project, which should be put in [...nextauth].ts:

try {
  // the regular exchange of access tokens from Google server with DRF backend
} catch (error) {
  const response = error.response?.data;
  if (
    response?.non_field_errors &&
    Array.isArray(response?.non_field_errors) &&
    response?.non_field_errors.length === 1
  ) {
    return `/auth/login?error=${encodeURIComponent(
      response?.non_field_errors[0],
    )}`;
  }

  return false;
}

See if it works. You should not be able to sign in when the clash happens, but your frontend will be more descriptive about it.

Happy holidays.

from nextjswithdrfexample.

w3ichen avatar w3ichen commented on May 19, 2024 1

Thank you so much! 🙏
It worked like a charm!

from nextjswithdrfexample.

mahieyin-rahmun avatar mahieyin-rahmun commented on May 19, 2024

Hi, need a bit more information. Once the django.urls.exceptions.NoReverseMatch: Reverse for 'socialaccount_signup' not found error is resolved using the StackOverflow solution, what is the next error that you are getting (backend/frontend)? Or is it that using the StackOverflow solution still resulted in the stacktrace that you provided?

from nextjswithdrfexample.

mahieyin-rahmun avatar mahieyin-rahmun commented on May 19, 2024

One other thing, your issue sounded familiar to something I had faced in a different project. Here is the corresponding issue that explains the situation (the solution is the same as the StackOverflow post but it's only partial). Can you confirm that the situation (not the solution) matches with yours?

from nextjswithdrfexample.

w3ichen avatar w3ichen commented on May 19, 2024

Hi @mahieyin-rahmun,
Thank you for the prompt response and happy holidays! 🎄

I believe it is the same situation from the other project.
I found the issue to be that: if a email already exists, and you try to sign in with google, it will give the error.
I found that if a user who has not already sign up using the email sign up, they can sign in with google and not encounter this issue.

How do you suggest I fix this? Would it be an issue with next-auth on the front end or allauth on the backend?
I tried the solution from the other issue: url(r"^accounts", include("allauth.urls")),, but it still gave me Reverse for 'socialaccount_signup' not found.

from nextjswithdrfexample.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.