I’m trying to update user information in a Vue app to enable the user to edit their profile.
After getting a token with the correct audience and scopes I still get a 400 Bad HTTP authentication header format error.
var auth0Authentication = new auth0.Authentication({
domain: options.domain,
clientID: options.clientId,
})
return auth0Authentication.login({
realm: 'Username-Password-Authentication',
username: username,
password: password,
audience: 'https://' + options.domain + '/api/v2/',
}, async (err, authResult) => {
if (err) {
this.error = err
this.loading = false
cb(err)
} else {
console.log('authResult', authResult)
var decodedAccessToken = jwtDecode(authResult.accessToken)
console.log('decodedAccessToken', decodedAccessToken)
var auth0Management = new auth0.Management({
domain: options.domain,
token: decodedAccessToken.azp,
})
auth0Management.getUser(decodedAccessToken.sub, (err, user) => {
console.log('err', err) // This is where I get an error
console.log('user', user)
})
cb(true)
}
})