0

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.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
I_Al-thamary
  • 3,385
  • 2
  • 24
  • 37

1 Answers1

1

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.

pg316
  • 1,380
  • 1
  • 8
  • 7
  • Thanks for answering my question.I really get a callback by using 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 I put my client id .I still required to provide username and password ,What I need, is to get the callback without using username and passowrd. – I_Al-thamary Apr 10 '15 at 12:31
  • ok let me make sure I understand. So you want to call the authorization link without the user having to input a username and password? If that is the case then having that happen is really only possible if the user is already logged in. If they are logged in already then they will not be asked to enter a username and password. Is that what you are looking for? – pg316 Apr 10 '15 at 14:58
  • I really appreciate your help. That's what I need ,because I need to access to my account by using client_id instead using username and password. – I_Al-thamary Apr 10 '15 at 23:55
  • I think that what you really want to do here though is authorize the user and store a refresh token. Then you won't ever have to worry about logging them in again. Again you can find full instructions on how to do this here: https://developer.sony.com/develop/services/lifelog-api/authentication/ – pg316 Apr 13 '15 at 16:29