Redirect uri

688 views
Skip to first unread message

spencerpieters

unread,
Feb 5, 2018, 11:56:09 AM2/5/18
to Strava API
Hi all,

There is something weird going on with the redirect_url during authorization of an iOS app.

Example of a redirect url is defined in my profile: thisismyapp.


and Strava would redirect to thisismyapp:// after the user accepts. iOS would then ask if the user wants to be redirected to the app that has thisismyapp defined as a uri. 

This is not the case. 

Strava api responds with an error saying the redirect_uri (thisismyapp://) is invalid.


(http://thisismyapp instead of thisismyapp://)

This offers the page with the Authorise button. However, after pressing Authorise the redirect uri becomes thisismyapp/?code=whatever.

In order for iOS to recognise this url the redirect uri should be thisismyapp://?code=whatever (notice the missing :/)

As things are now, I think the authorization flow is broken for iOS apps.

Both RunKeeper and Fitbit use a similar flow and these work fine.

Is this a known issue?

Many thanks in advance.

spencerpieters

unread,
Feb 6, 2018, 2:10:08 AM2/6/18
to Strava API
Hi again,

If anyone else is having problems with this, here's a workaround I found last night.

It seems that Strava cannot redirect to a custom url scheme like thisismyapp:// as mentioned above. Instead it prefers to redirect to a http(s) url.

What I did was set up a route on my website, ex. https://www.thisismyapp.com/thisismyapp and I define www.thisismyapp.com as the redirect_uri in the definition of the Strava app.

What my website does when https://www.thisismyapp.com/thisismyapp is hit, is redirect to thisismyapp://. All you need to do is get all the query parameters that Strava appends to https://www.thisismyapp.com/thisismyapp and add them to thisismyapp://

For example: https://www.thisismyapp.com/thisismyapp/?code=12345 redirects to thisismyapp://?code=12345

This then triggers the iOS app if you defined thisismyapp as a custom url scheme inside your iOS app.

You basically you redirect Strava's redirect_uri.

I hope this helps.

All the best.


Op maandag 5 februari 2018 17:56:09 UTC+1 schreef spencerpieters:

jul...@omata.com

unread,
Feb 14, 2018, 6:36:39 PM2/14/18
to Strava API
Hello,

I may be having a similar issue. Authorization via Strava has been broken in a codebase for which it has worked for 9 months. Suspicious..

The redirect_uri should work as expected, rather than reconfigured to be redirected via a website elsewhere. (Which is not practical in the case where you just have an App..not a website and an App.)

Anyone from Strava care to offer some insights?

Julian
Message has been deleted

anshul....@gmail.com

unread,
Jan 4, 2019, 2:07:49 AM1/4/19
to Strava API
Hello,

I am also facing the same issue. Strava does not allow to register myapp:// as the redirect uri. Is there any other work around for this rather then redirecting it to a website and then back again to the app as @spencerpieters has explained in his second message.

Anybody from Strava Support have any ideas or solution for this ?

Thanks In Advance.

Anshul

Dave Hughes

unread,
Jan 5, 2019, 1:32:26 AM1/5/19
to Strava API
Listen to localhost:<port> and use that as the redirect_uri. Localhost and 127.0.0.1 are whitelisted, as per the documentation:
https://developers.strava.com/docs/authentication/

Possibly relevant:
https://stackoverflow.com/a/31453622

anshul....@gmail.com

unread,
Jan 7, 2019, 7:01:07 AM1/7/19
to Strava API

I have contacted Strava Developer Support for the above said issue and got their reply that we can register myapp.com as authorisation callback domain in strava, myapp as url scheme in info.plist and myapp://myapp.com as the redirect uri for strava api.

After implementing this, my app works well and performs the oauth flow as is supposed to do.

Michael Chartier

unread,
Apr 12, 2019, 9:16:26 PM4/12/19
to Strava API
You sir deserve a special prize for this answer!  I have been searching for hours to find this. Thank you!
Reply all
Reply to author
Forward
0 new messages