Announcements

Help Wizard

Step 1

NEXT STEP

Refresh token replying with ETIMEDOUT

Refresh token replying with ETIMEDOUT

When getting an access_token using a refresh_token i get a ETIMEDOUT error. I have used your code from this page: https://developer.spotify.com/documentation/general/guides/authorization/code-flow/ under the section Request a refreshed Access Token

 

Here is my code:

var authOptions = {
      headers: {
        Authorization:
          "Basic " +
          new Buffer(client_id + ":" + client_secret).toString("base64"),
      },
      form: {
        grant_type: "refresh_token",
        refresh_token: refreshToken,
      },
      json: true,
    };

    request.post(authOptions, function (error, response, body) {
      if (!error && response.statusCode === 200) {
        var access_token = body.access_token;
        res.send({
          access_token: access_token,
        });
      } else {
        console.log(error);
      }
    });
Reply
0 Replies

Suggested posts