Create user invalid access token

Description/Error
Using the jwt sample app provided on github ,I generate access token and get the user info ,
then i try to send post request using axios to create user i get error code 124 message invalid access token

here is my index.js code

axios({
  method: 'post',
  url: 'https://api.zoom.us/v2/users',
  data: {
    'action': 'create',
    "user_info": {
      'email': 'dhjdfkghdskjf@fgkjfdlgjfkd.gh',
      'type': 1,
      'first_name': 'Terry',
      'last_name': 'Jones'
    }
  },
  auth: {
    'bearer': token
  },

  headers: {
    'User-Agent': 'Zoom-api-Jwt-Request',
    'content-type': 'application/json'
  }
})
.then(function(response) {
  //handle success
  console.log(response);
})
.catch(function(response) {
  //handle error
  console.log(response);
});

Hey @defconalert11,

As stated here, axios does not support the bearer for the auth object.

auth indicates that HTTP Basic auth should be used, and supplies credentials.
This will set an Authorization header, overwriting any existing
Authorization custom headers you have set using headers.
Please note that only HTTP Basic auth is configurable through this parameter.
For Bearer tokens and such, use Authorization custom headers instead.

Instead, specify the bearer in the headers like this:

axios({
  method: 'post',
  url: 'https://api.zoom.us/v2/users',
  data: {
    'action': 'create',
    "user_info": {
      'email': 'dhjdfkghdskjf@fgkjfdlgjfkd.gh',
      'type': 1,
      'first_name': 'Terry',
      'last_name': 'Jones'
    }
  },
  headers: {
    'Authorization': 'Bearer JWT_TOKEN_HERE'
    'User-Agent': 'Zoom-api-Jwt-Request',
    'content-type': 'application/json'
  }
})
.then(function(response) {
  //handle success
  console.log(response);
})
.catch(function(response) {
  //handle error
  console.log(response);
});

Let me know if that works!

Thanks,
Tommy

here is my log after using the code you provided

the request seems to work thanks a lot sir .

Yep it worked! You can see the response body in the data object!

Happy to help! :slight_smile:

Thanks,
Tommy