question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalStateException in GoogleIdentityProvider.onPermissionsRequireExplanation

See original GitHub issue

Hi,

We upgraded to 1.17.0 and are having a major problem with the native Google authentication. We thought we were using the textbook integration :

// setup Auth0 and the native Google integration
ParameterBuilder paramsBuilder = ParameterBuilder.newBuilder();
String scope = ParameterBuilder.SCOPE_OFFLINE_ACCESS + " email";
Map<String, Object> parameters = paramsBuilder.setScope(scope).asDictionary();

LockContext.configureLock(
        new Lock.Builder()
                .loadFromApplication(this)
                .withIdentityProvider(Strategies.GooglePlus, new GoogleIdentityProvider(this))
                .authenticationParameters(parameters)
);

When a user uses the Google authentication button, the native integration correctly asks for permission to access the contacts, then if the user cancels that request, all future use of the Google auth button will crash the app with this stacktrace :

08-18 22:55:40.078 24786-24786/<REDACTED> E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: <REDACTED>, PID: 24786
                                                              java.lang.RuntimeException: Could not dispatch event: class com.auth0.lock.event.IdentityProviderAuthenticationRequestEvent to handler [EventHandler public void com.auth0.lock.LockActivity.onIdentityProviderAuthentication(com.auth0.lock.event.IdentityProviderAuthenticationRequestEvent)]: You need to use a Theme.AppCompat theme (or descendant) with this activity.
                                                                  at com.squareup.otto.Bus.throwRuntimeException(Bus.java:456)
                                                                  at com.squareup.otto.Bus.dispatch(Bus.java:386)
                                                                  at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:367)
                                                                  at com.squareup.otto.Bus.post(Bus.java:336)
                                                                  at com.auth0.lock.fragment.SmallSocialListFragment$1.onItemClick(SmallSocialListFragment.java:84)
                                                                  at android.widget.AdapterView.performItemClick(AdapterView.java:310)
                                                                  at android.widget.AbsListView.performItemClick(AbsListView.java:1145)
                                                                  at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066)
                                                                  at android.widget.AbsListView$3.run(AbsListView.java:3903)
                                                                  at android.os.Handler.handleCallback(Handler.java:739)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:148)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                               Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
                                                                  at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:343)
                                                                  at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312)
                                                                  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277)
                                                                  at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:80)
                                                                  at android.support.v7.app.AlertController.installContent(AlertController.java:214)
                                                                  at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:257)
                                                                  at android.app.Dialog.dispatchOnCreate(Dialog.java:394)
                                                                  at android.app.Dialog.show(Dialog.java:295)
                                                                  at android.support.v7.app.AlertDialog$Builder.show(AlertDialog.java:953)
                                                                  at com.auth0.google.GoogleIdentityProvider.onPermissionsRequireExplanation(GoogleIdentityProvider.java:97)
                                                                  at com.auth0.identity.AuthorizedIdentityProvider.checkPermissions(AuthorizedIdentityProvider.java:156)
                                                                  at com.auth0.identity.AuthorizedIdentityProvider.start(AuthorizedIdentityProvider.java:72)
                                                                  at com.auth0.lock.LockActivity.onIdentityProviderAuthentication(LockActivity.java:296)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89)
                                                                  at com.squareup.otto.Bus.dispatch(Bus.java:384)
                                                                  at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:367) 
                                                                  at com.squareup.otto.Bus.post(Bus.java:336) 
                                                                  at com.auth0.lock.fragment.SmallSocialListFragment$1.onItemClick(SmallSocialListFragment.java:84) 
                                                                  at android.widget.AdapterView.performItemClick(AdapterView.java:310) 
                                                                  at android.widget.AbsListView.performItemClick(AbsListView.java:1145) 
                                                                  at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066) 
                                                                  at android.widget.AbsListView$3.run(AbsListView.java:3903) 
                                                                  at android.os.Handler.handleCallback(Handler.java:739) 
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                  at android.os.Looper.loop(Looper.java:148) 
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                  at java.lang.reflect.Method.invoke(Native Method) 
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

This is on a Nexus 5, Android 6.0.1, in an app with these settings :

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
...

Gradle : 2.14.1 Android Plugin : com.android.tools.build:gradle:2.1.3

Debugging a little bit this issue, as the AppCompat dialog builder is using the context from the application, it’s true that there is no theme. But the issue should not be there, as we got the code from the Auth0 sample code which also uses the application instance to build the GoogleIdentityProvider.

Happy to provide more info if needed. Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
hzalazcommented, Aug 29, 2016

@pmq will be officially fixed when that last pr ☝️ is merged and released

0reactions
pmqcommented, Aug 29, 2016

@hzalaz thanks Hernan !

Read more comments on GitHub >

github_iconTop Results From Across the Web

IllegalStateException - Android Developers
Google uses cookies to deliver its services, to personalize ads, and to analyze traffic. You can adjust your privacy controls anytime in your...
Read more >
Manage workload identity pools and providers - Google Cloud
Access resources from a SAML 2.0 identity provider. Required roles. To get the permissions that you need to manage workload identity pools and...
Read more >
SAML app error messages - Google Workspace Admin Help
If you encounter any Security Assertion Markup Language (SAML) app error messages, here are some troubleshooting steps to help you.
Read more >
Common Issues with SAML Authentication - Blackboard Help
SAML : Security Assertion Markup Language; IdP: Identity Provider; SP: Service Provider; ADFS: Active Directory Federation Services; GUI: Graphical User ...
Read more >
Identity providers and federation - AWS Documentation
Your external users sign in through a well-known IdP, such as Login with Amazon, Facebook, or Google. You can give those external identities...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found