DEV Community

Tim Dang
Tim Dang

Posted on

I have error when use patchUserMetadata API belong to Auth0-js

I’m trying to update metadata for users with pathUserMetadata. Below is my code:

 management = new auth0.Management({
    domain: environment.domain,
    token: this.cookieService.get('access_token'),
    clientId: environment.clientId,
    clientSecret: environment.cliendSecret,
    scope: 'create:users read:users update:users openid profile email',
});
Enter fullscreen mode Exit fullscreen mode
this.auth0.management.patchUserMetadata(
        'auth0|xxx' , //of xxx
        userMetadata,
        (err, res) => {
          console.log('err', err);
          console.log('res', res);
        }
);

Enter fullscreen mode Exit fullscreen mode

but it alway return

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Bad HTTP authentication header format",
    "errorCode": "Bearer"
}
Enter fullscreen mode Exit fullscreen mode

How can I run this API?

Top comments (0)