question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OAuth2 password flow sends token request incorrectly

See original GitHub issue

Seems that at least when using Resource owner password credentials flow for authentication, token request is sent incorrectly. Currently code on master sends is like this (/src/core/plugins/auth/actions.js)

let req = {
    url: schema.get("tokenUrl"),
    method: "post",
    headers: {
      "content-type": "application/x-www-form-urlencoded"
    },
    query: {
      grant_type: "password",
      username,
      password,
      scopes: encodeURIComponent(auth.scopes.join(scopeSeparator))
    }
  }

This means that all parameters are sent as query parameters not as part of body as spec defines (https://tools.ietf.org/html/rfc6749#section-4.3.2).

it could use instead body: new FormData(...) of query: {...}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lakmalicommented, Apr 19, 2017

I am also facing this problem. There is a configuration for sending client credentials; whether to send it as Basic header or in body. But there is no configuration available for sending payload data. Nevertheless, according to the spec, payload should be sent as URL encoded POST payload. So I think, this needs to be fixed.

1reaction
bodniacommented, Apr 27, 2017

@jniemin thanks for your cooperation

Read more comments on GitHub >

github_iconTop Results From Across the Web

OAuth 2.0 Username-Password Flow Problem
This defeats process of authentication through oauth.You can ask the user to enter crendentials himself and then store oauth token somewhere in ...
Read more >
Why I have an error performing password flow when I login?
It seems like your Token Endpoint is configured to use a different Authentication Method. There is an error shown invalid_client , it looks ......
Read more >
OAuth 2.0 Authorization Errors - Salesforce Help
Errors can occur during OAuth authorization. For example, a user denies access to the connected app or request parameters are incorrect.
Read more >
The Authorization Response - OAuth 2.0 Simplified
redirect_uri – The redirect URL that was used. This needs to be stored since the access token request must contain the same redirect...
Read more >
Confusing error message on failed refresh token request
Can you share the request you are sending when you got that error message. When you use V2 endpoint , it is mandatory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found