i have created a Android application, In the application i have got the Client ID, Client Secret from here https://www.strava.com/settings/api . In the redirect uri I’m giving my app package but it is not redirected to the application.
here is my manifest file:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.StravaPrac"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.StravaPrac">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="careplix.com"
android:pathPrefix="/token-exchange"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>`
i tried giving a different url, there the redirect is working. I’m getting the client code, state everything but the when i give app package it doesn’t work, It should redirect back to the app.
here is some code to catch the response:-
if (response != null) {
val tokenRequest = TokenRequest.Builder(response.request.configuration, clientId)
.setGrantType(GrantTypeValues.AUTHORIZATION_CODE)
.setCodeVerifier(response.request.codeVerifier)
.setAuthorizationCode(response.authorizationCode)
.setRedirectUri(redirectUri)
.setRefreshToken(clientRefreshToken)
.build()
Subham Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.