After setting localhost as callback web auth doesn't back to my Application

469 views
Skip to first unread message

Alireza Soltani Neshan

unread,
Aug 15, 2022, 10:28:29 AM8/15/22
to Strava API
Hi everyone and hi to all Strava team! I'm Alireza Soltani, a Mobile app developer. I am developing big Application about the health and Fit base application. 
As a the best feature we want connect our app to some Health api like GoogleFit/AppleFit and Strava.
Strava is the best!!!
My Mobile app is base on Flutter framework.
I have problem with web Authn of my app to authorizing with Strava. Users can successfully login to Strava server but my app doesn't back to main view of the app and stop process in callback url (http://localhost).
What is the probelm?
I searched a lot of hours. but nothing :(
Strava developers console doesn't accept add a url with schema like signed://localhost.
How can i fix this issue??
Here is my screenshot about auth with auth in my Flutter app.
Screen Shot 1401-05-24 at 6.26.01 PM.png
Screenshot_1660572024.png
Screenshot_1660556856.png
Here is my response of successful login to Strava:
Screen Shot 1401-05-24 at 6.33.15 PM.png

Grimp Eur

unread,
Aug 17, 2022, 1:14:40 PM8/17/22
to Strava API
I believe I had the same issue when I implemented the Strava integration in my software and the workaround I did was to specify a portname as below:

localhost:XXXX

That works for me now, you might want to test it.

Alireza Soltani Neshan

unread,
Sep 2, 2022, 8:48:53 AM9/2/22
to Strava API
Yep i tested your solution. But nothing get to work!

Alireza Soltani Neshan

unread,
Sep 2, 2022, 9:13:27 AM9/2/22
to Strava API
I found somethings that i can to say I know what is the problem! Problem is related to multiple browser in client side. When users have been installed multiple browser this problem will demonstrate. For clearing what i said: when you install Google Chrome, Samsung Browser, Brave for Mobile and somethings else in your Android phone, This redirection doesn't work in Android device. I had very research that how can i fix this bug in Flutter Android version (i have didn't test in iOS device because we had expired our AppleDeveloper account and revival of that, will have a lot of time consuming in our Country). When i test this in Android Emulator that is fresh and has only one browser, that is Google Chrome, That work perfectly fine, but when i install second browser in this emulator this redirection doesn't work and will be at `localhost` address. (Android 12 in Android emulator with API-V32)

Implementation is super simple.
At AndroidManifest i set this intent filter:

```xml
             <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="localhost" />
                <data android:scheme="https" android:host="localhost" />
            </intent-filter>
```

And in app/build.gradle i set:

```gradle
defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.paya_health_bonus"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 24
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        // ---------------------------This section----------------------------
        manifestPlaceholders += [
            "appAuthRedirectScheme": "localhost",
            "appAuthRedirectScheme": "http"
        ]
    }
```
You can see this problem its fine in android emulator with default browser(Video)
And with my real Android phone with multiple web browser(Video)

Alireza Soltani Neshan

unread,
Sep 2, 2022, 9:21:50 AM9/2/22
to Strava API
Why i achieve this reasoning? Read more that will help you to find my reasoning 

Luis Lopez

unread,
Sep 2, 2022, 5:19:16 PM9/2/22
to Strava API
some years ago a page the localhost page was working and then something changed from strava end, page works on my server and localhost no data is returned.
my only way to work with localhost is to create a fake dataset

Alireza Soltani Neshan

unread,
Sep 2, 2022, 11:53:00 PM9/2/22
to Strava API
Hi, When I use from localhost all things is okay, When user use Google account for sign in to Strava, after pushing Authorization button, it will navigate to localhost with a code query param that contain Authorization code of the users. If you watch my attached video in above you can see what is my problem.

Thanks for this response and all response that you send in future.

Alireza Soltani Neshan

unread,
Sep 13, 2022, 2:11:33 PM9/13/22
to Strava API
Anyone have an idea to fix this issue?

reena bains

unread,
Oct 12, 2022, 12:24:47 AM10/12/22
to Strava API
Hello sir,

Have you found the solution for this issue?

Alireza Soltani Neshan

unread,
Oct 27, 2022, 2:24:10 AM10/27/22
to Strava API
Hi friend.
I haven't found anything yet. I used flutter_appauth, and I tested it in iOS phone but doesn't work. Even in iOS it open with OIDC but after login into Strava and after callback it doesn't back to app and freeze inside of local host or any uri you set in your strava developer panel.

Alireza Soltani Neshan

unread,
Nov 11, 2022, 2:27:09 AM11/11/22
to Strava API
Hi everyone, after 3 fucking months near by all my works and tasks, I found solution!
In Strava developer panel, you must save an url callback, but this URL is not a real uri, it is simple, like redirect, that I used for my app. Note that from Strava API, url scheme submitted by Strava developers. It is static and unchangeable, URL scheme from Strava developer is `stravaflutter://<callback_url>` like `stravaflutter://redirect`.
It solved my bug inside of url callback. All levels is same as before, you must change only this url callback (Just for flutter web authn developers).

Keep shining developers and Strava team!
Reply all
Reply to author
Forward
0 new messages