0

This might be a really dumb question, but I need help. I have a website that authenticates a user through OAuth with their Google accounts. The problem is that after I press logOut button (now the token is null), if I press again the logIn button the pop-up used for credentials, this one: enter image description here

doesn't appear and the client is logged automatic.. .. I don't have any more ideas about this problem..

Thank you

gapi.auth.signOut(); if (!gapi.auth.getToken()) { console.info('Now signed out, token null.'); }

this is my signout code, and the info appears into the console. I use angular-google-plus.js and my login looks like this:

 GooglePlus.login().then(function(authResult) {

            if (authResult['access_token'] && !authResult.error) {
                var accessToken = gapi.auth.getToken().access_token;

                gapi.client.load('plus', 'v1', apiClientLoaded);

            } else {
                $scope.welcomeMsgGoogle = "autentificare eronata";
            }
        });


           function apiClientLoaded() {
        gapi.client.plus.people.get({ 'userId': 'me' }).execute(handleEmailResponse);
    }
    function handleEmailResponse(user) {
        var accessToken2 = gapi.auth.getToken().access_token;
        gapi.auth.setToken(accessToken2);
    /// some code

    }

I try to use cookie_policy: 'single_host_origin' and still doesn't work..

florinaL
  • 93
  • 1
  • 9
  • If I understood correctly, then this is normal.. oauth2 with google works the same way you install an app in android .. you accepts the scopes in the first time, and the app is granted access .. which means the user will not need to see this screen everytime – MayK Nov 06 '15 at 14:17
  • ... but I press the logOut button.. and the user is still logged – florinaL Nov 06 '15 at 14:22
  • .. the user is never really logged out from your application. what you can do is create a logout screen.. next time the user comes he will be automatically logged in.. and don't do an aggressive Logout because then you will log the user out of google : ) – MayK Nov 06 '15 at 14:25
  • I've made a mistake, the pop-up where you introduce your credentials does'n appear.. so I can introduce the e-mail and password for login.. the second time when I press the login button the user is logged in automatically – florinaL Nov 06 '15 at 14:31
  • I don't want to make an aggressive logout, I just want to logout from my application.. – florinaL Nov 06 '15 at 14:36
  • I find the answer here http://stackoverflow.com/a/19356354/1749752, but I don't really understand how to implement it. Could you please post an example for me? thank you – florinaL Nov 10 '15 at 08:02
  • So in the end I used this answer http://stackoverflow.com/a/14831349/1749752 – florinaL Nov 11 '15 at 11:20
  • can you post how you did it in an answer please ? – MayK Nov 11 '15 at 14:09

0 Answers0