You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there. Since upgrading to the Android 14 Beta 3 (API 34), the OAuth2 Redirect URI always comes out to be null, resulting in the AuthorizationManagementActivity's onResume() to return RESULT_CANCELED. The existing code works for Android 13 and below, and the newest Android release might be introducing a breaking change. Any help would be appreciated, as the full release of Android 14 is expected in August/September.
Here is the code where I launch the RedriectUriReceiverActivity:
private var resultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
if (result.data == null || result.resultCode == RESULT_CANCELED) {
// handle failure
} else if (result.resultCode == RESULT_OK) {
val authResp = AuthorizationResponse.fromIntent(result.data!!)
val authEx = AuthorizationException.fromIntent(result.data)
// do stuff
}
}
private fun launchBrowserForAuth() {
val authStateSyncHelper = serviceLocator.authStateSyncHelper
val authorizationService = AuthorizationService(
serviceLocator.context,
AppAuthConfiguration.Builder()
.setBrowserMatcher(generateBrowserAllowList())
.build()
)
val serviceConfig = AuthorizationServiceConfiguration(
Uri.parse(BuildConfig.PROVIDER_URL), // authorization endpoint
Uri.parse(BuildConfig.TOKEN_URL)
) // token endpoint
authStateSyncHelper.replace(AuthState(serviceConfig))
val authRequest = AuthorizationRequest.Builder(
serviceConfig, // the authorization service configuration
BuildConfig.CLIENT_ID, // the client ID, typically pre-registered and static
ResponseTypeValues.CODE, // the response_type value: we want a code
Uri.parse(BuildConfig.OAUTH_REDIRECT_URI)
) // the redirect URI to which the auth response is sent
.setScope(BuildConfig.SCOPE)
.build()
val authIntent = authorizationService.getAuthorizationRequestIntent(
authRequest
)
resultLauncher.launch(authIntent)
}
The text was updated successfully, but these errors were encountered:
Have tested the demo app in both beta3 and now beta4 with both custom schema and AppLink and haven't noticed anything new.
There may be issue as we've seen with Android 12 where the activity was being recreated #769 but we need some further information on the observed lifecycle to understand it.
Thanks @agologan
Issue was resolved by defining the AuthorizationManagementActivity as a SingleInstance with help from #977 <activity android:name=".AuthorizationManagementActivity" android:exported="false" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden" android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar" android:launchMode="singleInstance" />
Checklist:
Configuration
Issue Description
Hi there. Since upgrading to the Android 14 Beta 3 (API 34), the OAuth2 Redirect URI always comes out to be null, resulting in the AuthorizationManagementActivity's onResume() to return RESULT_CANCELED. The existing code works for Android 13 and below, and the newest Android release might be introducing a breaking change. Any help would be appreciated, as the full release of Android 14 is expected in August/September.
Here is the code where I launch the RedriectUriReceiverActivity:
The text was updated successfully, but these errors were encountered: