GithubHelp home page GithubHelp logo

nextjs-auth0-starter's People

Contributors

captainchemist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nextjs-auth0-starter's Issues

How to avoid the boilerplate for auth check?

Thanks for the tutorial!

I'm currently struggling to create a template that can be shared by all pages so I don't have to write the auth boilerplate everytime. Is there a way around it?

https://github.com/CaptainChemist/nextjs-auth0-starter/blob/master/pages/profile.tsx#L15-L26

Having to write this all the time will be extremely tedious

  const { user, loading } = useFetchUser();

  if (loading) {
    return (
      <MainLayout>
        <p>Loading...</p>
      </MainLayout>
    );
  }
  if (!user && !loading) {
    Router.replace('/');
  }

GET http://localhost:3000/api/me 401 (Unauthorized) user.tsx:9

I'm having trouble with this error code I'm getting from chromes dev console.. GET http://localhost:3000/api/me 401 (Unauthorized) user.tsx:9 .. When I open localhost:3000, in the navbar I see the Home and Login, when I click on Login I'm sent to the Auth0 Login, but every time I try to Login (either using my Auth0 login creds or through a google account) it gives me this error code as well Failed to load resource: the server responded with a status of 401 (Unauthorized) :3000/api/me:1. I tried looking for a solution the past couple of days but came up with nothing that has worked.

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.