-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jwt_auth_bad_auth_header #3
Comments
How can I control the header ? |
You need to be sure you send the proper token along the header app.config( function( $httpProvider ) {
$httpProvider.interceptors.push( [ '$q', '$location', '$cookies', function( $q, $location, $cookies ) {
return {
'request': function( config ) {
config.headers = config.headers || {};
//Assume that you store the token in a cookie.
var globals = $cookies.getObject( 'globals' ) || {};
//If the cookie has the CurrentUser and the token
//add the Authorization header in each request
if ( globals.currentUser && globals.currentUser.token ) {
config.headers.Authorization = 'Bearer ' + globals.currentUser.token;
}
return config;
}
};
} ] );
} ); You need to verify the content in this line config.headers.Authorization = 'Bearer ' + globals.currentUser.token; In this example i asume that you are using cookies to store the token. |
I'm sorry but this is not the place to ask how to store a cookie or how to consume the REST API This plugin only give you the ability to sign a request and authenticate the user using the JWT token. You can find more information on how to use the WP REST API in the documentation site |
OK Sorry. |
hi PyNApo, would you share your solution?i'm facing the same problem |
nevermind,..i got it working |
hi, I have the same problem with Postman in my local server. Tks, |
@h3ndro @PyNApo and what was your solution?? screenshot of Postman or something? |
Hello,
Thanks for your plugin.
When i try your sample request with angular i've this response:
"code": "jwt_auth_bad_auth_header",
"message": "Authorization header malformed.",
"data": {
"status": 403
}
What's wrong ?
The text was updated successfully, but these errors were encountered: