Auth0 Home Blog Docs

Generic 403 when instantiating Auth0Lock in React

lock
auth0

#1

This is an example of where I’m importing and attempting to instantiate Auth0Lock (v11):

import React, { Component } from 'react'
import Auth0Lock from 'auth0-lock'

class App extends Component {
  constructor() {
    super()

    this.lock = new Auth0Lock('CLIENT_ID', 'DOMAIN.auth0.com')
    this.state = {}
  }
}

Every time I start my app I get a generic 403 response from Auth0. I’ve double-checked my credentials, added “https://localhost:3000” to my allowed origins settings, triple-checked the API docs, and googled around, but really don’t know where to go from here.

Any help would be appreciated!


#2

It would be helpful to get the console error, and/or any network response from developer console to help diagnose this particular error.

That said, I would highly recommend checking out the React Quickstart from Auth0. It will use the auth0.js library instead of lock, and will use lock on the hosted login page. There are many advantages to using universal login (redirecting to your Auth0 tenant) to collect credentials. One of the most important being that you will have issues with certain browsers that have disabled third-party cookies if you are not using a custom domain.


#3

Right, I may go with that. I just figured out that it was actually my callback URL. My bad, but thanks for the advice!