Auth0 Home Blog Docs

Auth0 authorization Extension API returns Undefined



I am trying to implement the Authorization API for Auth0 Authorization extension. I followed through the guide here (

I was able to successfully get an access_token.
But when I call the Api with the access token, I only get ‘undefined’ with a 401 unauthorized error.

The following is the relevant code in my main.js file of the VueJs Application

let ACCESS_TOKEN = '''', config.body, config.headers)
.then(response => {
.then(response => {
  const AuthString = 'Bearer '+ (ACCESS_TOKEN)
{ authorization : AuthString})})
.then(object => {

The image is the response i get in console.log and the scopes in my API

I have posted the question in Stackoverflow as well


@alosies I think for gets you have to wrap the object within an object. Try doing something like:
const headers = { Authorization: AuthString };

Then inside your axios get request do axios.get(url, { headers }). So essentially you are doing { { authorization: Authstring } }


@tbaustin Thanks for looking into it.

I tried doing what you said, but now I am getting a 500 internal server error.
Current code given below

let ACCESS_TOKEN = "";“”, config.body, config.headers)
.then(response => {
.then(response => {
const AuthString = "Bearer " + ACCESS_TOKEN;
const headers = { Authorization: AuthString };
{ headers }
.then(object => {


@alosies I am using react, but I think axios would work the same way. Let me show you how I am doing it and see if that helps.

const generateToken = () => {
  const headers = {
    'content-type': 'application/json'
  const body = {
    grant_type: 'client_credentials',
    client_id: 'client_id',
    audience: ''
  return new Promise((resolve, reject) => {
      .post('', body, headers)
      .then(res => {
      .catch(err => {

Now that I have made this function I use it in another file:

      .then(token => {
        const headers = { Authorization: `Bearer ${token}` };
        return axios.get(`${user.sub}`, {
      .then(res => {
      .catch(err => {
          err: err.message

Ignore the state part as that pertains to react. Make sure you are using the client ID and what not for the api you have specified as well.


@tbaustin, thanks for sharing the code.

I could implement the login functionality using the Management API(

I am trying to set up the Authorization extension which allows us to set Roles, Groups and Permissions( The ‘audience’ for the this is given as ‘urn:auth0-authz-api’. Please check this image

Are you able to set roles and permissions on your app through the API you set up?


I have not tried yet, but I am not using a custom api . Also in your client that you are using make sure it is non-interactive and that you also authorize that client in your custom api under the Non Interactive Clients tab.


Let me know if you need help with that part.


Ya, that part I could manage to do successfully. Reference Image

Thanks for taking your time out and helping.:smile:

Let me wait for someone who has implemented authorization API to give me some directions.


Sounds good! From what I have found 401 errors are either a setting somewhere you have missed or you aren’t passing the token correctly in the header. But from what I see you are doing that all correctly.

Best of luck!


Can someone help on this please