auth0 / angular-lock

MIT License
18 stars 15 forks source link

Username-Password works but social buttons don't/spin #16

Closed nonsenseless closed 4 years ago

nonsenseless commented 7 years ago

The basic issue I'm facing is that the social login buttons don't work in Android. I can use the username/password fields, but when I press "Log in with facebook" or "Log in with google" a spinner comes onscreen and spins indefinitely.

I'm working from the auth0-Ionic guide here: https://auth0.com/docs/quickstart/native/ionic/00-intro

I've installed the components via bower and am using the following versions (which are included in index.html):

    "auth0-lock": "^10.7.3",
    "angular-lock": "^1.0.5",
    "angular-jwt": "^0.1.8",

My config has:

        lockProvider.init({
            domain: 'appname.auth0.com',
            clientID: 'token',
            options: {
                auth: {
                    redirect: true,
                    params: {
                        scope: 'openid',
                        device: 'Mobile device'
                    }
                }
            }
        });

        // Configuration for angular-jwt
        jwtOptionsProvider.config({
            tokenGetter: function() {
                return localStorage.getItem('id_token');
            },
            whiteListedDomains: ['localhost'],
            unauthenticatedRedirectPath: '/main/login'
        });

My auth service ('Authentication') has the following (which is not fully fleshed out):

 this.login = function() {
            lock.show();
        }

        this.logout = function() {
            localStorage.clear();
            $state.go("main.login");
        }

        this.registerAuthenticationListener = function() {
            console.log("Registering listener");
            lock.on('authenticated', function(authResult) {
                console.log('authenticated');
                localStorage.setItem('id_token', authResult.idToken);
                authManager.authenticate();
                lock.hide();

                // Redirect to default page
                location.hash = '#/';

                lock.getProfile(authResult.idToken, function(error, profile) {
                    if (error) {
                        console.log(error);
                    }

                    localStorage.setItem('profile', JSON.stringify(profile));
                });
            });
        }

        this.checkAuthOnRefresh = function() {
            var token = localStorage.getItem('id_token');
            if (token) {
                if (!jwtHelper.isTokenExpired(token)) {
                    if (!$rootScope.isAuthenticated) {
                        authManager.authenticate();
                    }
                }
            }
        }

Authentication.registerAuthenticationListener is called within ionicPlatform.ready and my login controller calls Authentication.login().

We were previously using auth0-angular and seeing the same behavior--it worked fine on iOS--and I switched over to the version in the auth0-ionic guide to see if that worked any better. I'm a little stumped as to what might be causing the problem, so any insight would be greatly appreciated.

ianitsky commented 7 years ago

Were you able to fix this issue?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️