Skip to content

Getting authorization_code fails due to missing access_token?!? #358

Open
@p-bakker

Description

@p-bakker

Hi,

I'm trying to get node-oauth2-server going. I've got the latest version installed and have this code
oauth.authorize(request, response) .then(function(success) { res.end(JSON.stringify(success)) }).catch(function(err) { response.statusCode = err.code || 500 res.end(JSON.stringify(err)) })

When this code is called with a request with the queryString response_type=code&client_id=CLIENT_ID&redirect_uri=http://www.someurl.com&scope=read
I get the following error returned:
{"message":"Unauthorized request: no authentication given","code":401,"name":"unauthorized_request"}

I've traced this into the code and it seems it is coming from the this.getUser(request, response) call on line 88 in authorize_handler.js, which calls this.authenticateHandler.handle, which calls this.getTokenFromRequest(request), which in turn looks foor the access_token, which I'm not sending in, so the thing bombs out.

Now, I'm not getting this at all. To my knowledge, when requesting an authorization code in oAuth2, I'm not supposed to send in an acces token, as the sole purpose of getting an autorization code is my client can then do a call to exchange the code for an access token. Or am I missing something?

Any insight appreciated.

Must say it's tough going with v3 documentation and samples not yet in place. Hope they'll be available soon

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions