I’m creating a custom social connection with Vin.li. I have a ll the information from the developers at Vin.li but I’m getting the "error": "invalid_request"
message when testing. I’m able to complete the full process of exchanging the code for an access token using a tool like POSTman:
Request
POST /oauth/token HTTP/1.1
Host: auth.vin.li
Content-Type: application/json
Authorization: Basic <removed>
{
"grant_type": "authorization_code",
"code": "<removed>",
"redirect_uri": "https://meterfeeder.auth0.com/login/callback"
}
Response
{
"access_token": "<removed>",
"expires_in": 15551999,
"token_type": "Bearer"
}
I can then use that access_token
to get the user account:
Request
GET /api/v1/users/_current HTTP/1.1
Host: auth.vin.li
Authorization: Bearer <removed>
Response
{
"user": {
"id": "<removed>",
"firstName": "Daniel",
"lastName": " ",
"email": "dan@example.com",
"phone": "+222-2222",
"image": null,
"createdAt": "2016-11-01T17:49:10.893Z",
"updatedAt": "2017-01-05T04:32:40.080Z",
"settings": {
"unit": "imperial",
"locale": "en-US"
}
}
}
Here is my Fetch User Profile Script:
function(accessToken, ctx, cb) {
request({
method: 'GET',
url: 'https://auth.vin.li/api/v1/users/_current'
headers: {
Authorization: 'Bearer ' + accessToken
}
}, function(err, resp, body) {
if (err) return cb(err);
if (resp.statusCode !== 200) return cb(new Error(body));
var profile = JSON.parse(body);
if (!profile || !profile.user) return cb(new Error(body));
var user = {
user_id: profile.user.id,
name: [profile.user.firstName, profile.user.lastName].join(' '),
email: profile.user.email,
picture: profile.user.image
};
cb(null, user);
});
}
I’ve triple checked the Client ID, Client Secret, and URLs. There is nothing in the Customer Headers field.
Any ideas to solve this problem would be appreciated!
Thanks,