0

I'm trying to collect and download my lifelog user data. The first step into doing this is getting a user-access token. I am encountering problems while requesting authorization.

From the sony developer authenticization page I am told to input the following code into my API explorer:

https://platform.lifelog.sonymobile.com/oauth/2/authorize?client_id=YOUR_CLIENT_ID&scope=lifelog.profile.read+lifelog.activities.read+lifelog.locations.read

I am supposed to receive the authorization code as such:

https://YOUR_CALLBACK_URL?code=abcdef

However, this is what the current situation is actually like:

I have replaced my actual client ID below with MY_CLIENT_ID for security reasons

INPUT:

GET /oauth/2/authorize?client_id=MY_CLIENT_ID&scope=lifelog.profile.read%2Blifelog.activities.read%2Blifelog.locations.read HTTP/1.1
Authorization:
Bearer kN2Kj5BThn5ZvBnAAPM-8JU0TlU
Host:
platform.lifelog.sonymobile.com
X-Target-URI:
https://platform.lifelog.sonymobile.com
Connection:
Keep-Alive

RESPONSE:

HTTP/1.1 302 Found
Content-Length:
196
Location:
https://auth.lifelog.sonymobile.com/oauth/2/authorize?scope=lifelog.profile.read+lifelog.activities.read+lifelog.locations.read&client_id=MY_CLIENT_ID
Access-Control-Max-Age:
3628800
X-Amz-Cf-Id:
HILH9w3eOm-6ebs_74ghegYQyWS4xyqA1l0gXPRJuuubsoZ6eiiS3g==
Access-Control-Allow-Methods:
GET, PUT, POST, DELETE
X-Request-Id:
76caccfc976d40259ef30415d10980e9
Connection:
keep-alive
Server:
Apigee Router
X-Cache:
Miss from cloudfront
X-Powered-By:
Express
Access-Control-Allow-Headers:
origin, x-requested-with, accept
Date:
Sun, 22 Jan 2017 03:00:42 GMT
Access-Control-Allow-Origin:
*
Vary:
Accept
Via:
1.1 dc698cd00b7ec82887573cfaba9ecca6.cloudfront.net (CloudFront)
Content-Type:
text/plain; charset=utf-8

Found. Redirecting to https://auth.lifelog.sonymobile.com/oauth/2/authorize?scope=lifelog.profile.read+lifelog.activities.read+lifelog.locations.read&client_id=MY_CLIENT_ID

Nowhere can I see the authorization code in the above code. I even tried copying and pasting the URL (on the last line) into my browser, it says "localhost.com took too long to respond"

This is where I input my request

API explorer page

I am not sure whether it is an issue with the callback URL. I don't have an actual website or app made, I just used the default localhost

I am a beginner in this and would really appreciate all help.

udidosa
  • 135
  • 11
  • What type of app are you building? If you are building for android or IOS your callback should probably be https://localhost. You will however have to handle the callback when it returns. If you are building a web application then you will need to create a callback page to capture the results of the authorization callback. Most likely though you will have to run this code on a webserver that is not pointing to localhost. If you are a beginner to oAuth the best solution is to use a library. There are many libraries out there for oAuth built using multiple languages. – pg316 Jan 24 '17 at 00:52
  • Thanks Robert , though I'm not entirely sure what to do. I'm not making an Android/iOS application. My end result is to export all my lifelog data (collected through my Sony phone) into an Excel file for my own record keeping and analysis. I think i need to get authorization and an access code in order to do so. Please advise if it's the right way thanks! I'm not sure where the web application comes in. Do i need a domain? I'm just using the default application I created on the API Explorer right now. Wouldn't that suffice? – udidosa Jan 24 '17 at 01:30
  • hmm... if you don't want to create an actual app to pull the data you could just use the API Explorer. Are you looking for a more complex solution than this? – pg316 Jan 24 '17 at 23:52
  • Hi Robert, I am indeed. For now, all the data I get on the Explorer is unformatted and raw. Making it difficult to import into excel. It's similar to a massive . Txt file. I was wondering if there's another way to export the data from API Explorer. Would love to make an app but no idea how to do this. – udidosa Jan 25 '17 at 02:57
  • I think that there may not be an easy way to do what you are looking for without creating some form of app. Alternatively, Lifelog does have an integration with IFTTT. https://ifttt.com/lifelog. With this you can sign up and have your calories,step count, miles/kilometers traveled automatically recorded in a spreadsheet on Google Drive. Could this be something that might work for you? – pg316 Jan 25 '17 at 18:24

0 Answers0