How to get the access token from Sony lifelog?

544 Views Asked by At

I want to get the access token from platform life-log.

What should I do to get the access token or code .I'm using Node.js. this is my request,but I didn't know how can I get the code.

 request.post({  
 url: 'https://platform.lifelog.sonymobile.com/oauth/2/token',
 form: {
         client_id: 'client',
         client_secret: ' secret',
         grant_type: 'authorization_code',
SCOPE :'lifelog.profile.read+lifelog.activities.read+lifelog.locations.read',
REDIRECT_URL    : 'https://localhost:8000/callback'
  },
   }, 
     function(err, res, body) {
     var accessToken = JSON.parse(body).access_token;

I appreciate any help on this.

1

There are 1 best solutions below

4
On BEST ANSWER

Have you already signed up for an account here? https://developer.sony.com/develop/services/lifelog-api/create-app/

If so then the steps on this page should be able to guide you in getting everything you need to make successful API calls: https://developer.sony.com/develop/services/lifelog-api/authentication/

The above documentation says that to get your code you will make a GET or POST request to this url: https://platform.lifelog.sonymobile.com/oauth/2/authorize?client_id=YOUR_CLIENT_ID&scope=lifelog.profile.read+lifelog.activities.read+lifelog.locations.read

When you sign up for an account you will be asked for a callback url. Make sure you have an endpoint in nodejs to handle the callback url you supplied. Once you run the above line of code and authenticate you will receive the "code" to your callback url. You can then follow the rest of the steps on the authentication page of the documentation to walk you through making your first API call.