Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start activity ComponentInfo{com.example.my_app/net.openid.appauth.RedirectUriReceiverActivity} #1023

Open
gargVader opened this issue Nov 23, 2023 · 2 comments
Labels

Comments

@gargVader
Copy link

Configuration

  • Version: 0.11.1
  • Integration: Kotlin
  • Identity provider: Google

Description

After authorizing, when the app tries to launch the RedirectUriReceiverActivity, I get the following error.
Error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.my_app/net.openid.appauth.RedirectUriReceiverActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

While creating AuthorizationRequest, I set the redirect url as

AuthorizationRequest.Builder(
            authServiceConfig,
            MY_CLIENT_ID_FROM_GOOGLE_CONSOLE,  
            ResponseTypeValues.CODE,  
            Uri.parse("com.googleusercontent.apps.MY_CLIENT_ID_FROM_GOOGLE_CONSOLE:/oauthredirect") // redirect URI
        )

My AndroidManifest.xml

        <activity android:name="net.openid.appauth.RedirectUriReceiverActivity"
            android:exported="true">
            <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="com.googleusercontent.apps.MY_CLIENT_ID_FROM_GOOGLE_CONSOLE"
                    android:path="/oauthredirect"/>
            </intent-filter>
        </activity>

In my build.gradle.kts

manifestPlaceholders["appAuthRedirectScheme"] = "com.googleusercontent.apps.MY_CLIENT_ID_FROM_GOOGLE_CONSOLE"

I launch the intent from the AuthorizationService.getAuthorizationRequestIntent() using the following launcher in my composable.

val authorizationLauncher = rememberLauncherForActivityResult(
        contract = ActivityResultContracts.StartActivityForResult(),
        onResult = {}
    )
@Zerro97
Copy link

Zerro97 commented Dec 18, 2023

I'm not sure if this is helpful, but for android 14, I managed to resolve the same error message by following the comments written in this issue (#977)

@vhschlenker
Copy link

The problems can indeed be solved with a hint from #977 :
Add android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar" (or any other appcompat-theme) to the RedirectUriReceiverActivity declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants