Skip to content

Function access_token returns bad request #191

@ivansenic

Description

@ivansenic

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions