简体   繁体   中英

Fitbit API Integration using oAuth 2.0 with chrome custom tabs in android

I am building an Android app which integrates Fitbit to get user's data.

For integrating FitBit, I'm using Custom Chrome Tabs. When passing uri it redirects upto access page, But when I click on 'Allow', it displays error and not redirecting to the activity where I define intent filter.

I am facing issue with redirect_uri. I don't have any server so i put redirect_uri as ******://logincallback

      <activity android:name=".ChromeCustomTabActivity">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="logincallback"
            android:scheme="******" />
    </activity>

在此处输入图片说明

在此处输入图片说明

SOLVED

<activity android:name=".ChromeCustomTabActivity">
       <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:host="logincallback"
            android:scheme="******" />
        </intent-filter>
    </activity>

The redirect_uri must be an exact match one of the values specified in your application settings(Callback URL). And Callback URL should be a public API that is accessible by fitbit, that can be a website url hosted locally in your system.

Check this:

https://dev.fitbit.com/docs/oauth2/#redirect-uris

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM