oauthjs/angular-oauth2

basic auth for /oauth/token

scne opened this issue · 3 comments

scne commented

Hi guys,
my /oauth/token is under basic auth. How use this library in this situation? I get this error
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}

If I call wiht cUrl with curl -X POST -vu xxxxxxx:yyyyyyyy http://127.0.0.1:8383/oauth2/token ......

You need to set Authorization header for example like this:

this.authOptions = {
      headers: {
        Authorization: 'Basic ' + authdata,
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    };

And then just call getAccessToken with options:

this.OAuth.getAccessToken(user, this.authOptions)

I got a same issue with you and then it's resolved by @baster33 feedback. Thanks @baster33.
I think it has to be fixed. It's incompatible.

@baster33 explained right. I also answered it on #86.