Skip to content
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

Function access_token returns bad request #191

Open
ivansenic opened this issue Dec 27, 2023 · 0 comments
Open

Function access_token returns bad request #191

ivansenic opened this issue Dec 27, 2023 · 0 comments

Comments

@ivansenic
Copy link

Seems that you are setting the wrong content type, at least it does not match the official documentation which requires application/json:

vimeo.js/lib/vimeo.js

Lines 333 to 346 in ef0771e

Vimeo.prototype.accessToken = function (code, redirectUri, fn) {
const options = {
method: 'POST',
hostname: module.exports.request_defaults.hostname,
path: authEndpoints.accessToken,
query: {
grant_type: 'authorization_code',
code,
redirect_uri: redirectUri
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}

The function responses with in such case is:

<!doctype html>
<html lang="en">
   <head>
      <title>HTTP Status 400 – Bad Request</title>
      <style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style>
   </head>
   <body>
      <h1>HTTP Status 400 – Bad Request</h1>
   </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant