Search code examples
androidauthenticationbrowseroauthfitbit

FitBit oAuth issue with Firefox or Internet browser


I have integrated Fitbit with my Android application. I am facing no challenge while connecting to Fitbit using Chrome browser, but when I am trying to connect it to Firefox or the default internet browser, it's not working.

Below is the intent filter I am using:

<activity
            android:name=".MyActivity"
            android:launchMode="singleTop"
            android:resizeableActivity="false"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar">

            <!-- FitBit intent filter to get call back data for Authentication API -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>

                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>

                <data android:scheme="myfitbit"/>
            </intent-filter>
        </activity>

Please suggest.


Solution

  • I figured out the issue.

    I had used android:launchMode="singleTop" which was preventing my app to receive the oAuth token on onNewIntent() of my recipient Activity. But this scenario was only happening when I tried to connect to Fitbit using any browser other than Chrome. Finally, I changed my launchMode to android:launchMode="singleTask"

    For more details, visit https://stackoverflow.com/a/36942185/3627429 answer.