Does the Strava API support authentication and API usage through the use of Cross-Origin Requests?
I was trying to write a simple app to migrate my data from Nike+ to Strava using the Strava API because I have about 1000+ runs and I don't really feel like doing that manually. I thought that writing a simple JS authenticator would interface nicely/easily with the oauth... however when posting to
strava.com/oauth/token, the browser preflights the post request sending and option request over to pre-validate, and then strava responds with a 302 redirect to
strava.com/login. I'm sure there are some of you out there that have run into this...
e.g.. the code looks something like this (assume client id, secret, and code is set...)
var data = {
client_id: xxxxxx,
client_secret: "xxxxxxx",
code: xxxxx
};
App.requestor.http.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
App.requestor.http({method: 'POST', url: url, dataType: "json", data: data});
But this is the response...
Cache-Control:
no-cache
Connection:
keep-alive
Content-Length:
94
Content-Type:
text/html; charset=UTF-8
Date:
Mon, 02 Jan 2017 04:15:03 GMT
Location:
Set-Cookie:
xxxxxxxx
Status:
302 Found
X-FRAME-OPTIONS:
DENY
X-Request-Id:
xxxxxxxxxxx
X-UA-Compatible:
IE=Edge,chrome=1
I would have expected something that should tell my browser what options are valid... am I missing something here? or do the services not support this?