본문 바로가기

카테고리 없음

웹에서 구글 자동 로그인 방지

function googleAuth() {

gapi.load('client:auth2', {

callback: function() {

gapi.client.init({

apiKey: 'Your_API_KEY',

clientId: 'YOUR_CLIENT_ID',

scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',

expires_in: 1000

}).then(

function(success) {

gapi.auth2.getAuthInstance().signIn().then(

function(success) {

var id_token = success.getAuthResponse().id_token;

var auth2 = gapi.auth2.getAuthInstance();

auth2.disconnect();

gapi.auth2.getAuthInstance().signOut();

angular.element($('body')).scope().loginGoogle(success.w3);

},

function(error) {}

);

},

function(error) {}

);

},

onerror: function() {

// Failed to load libraries

}

});

}

토큰 강제 삭제와 로그아웃을 동시에 시행한다.

이미 게임에는 잘 로그인 되었으므로 굳이 구글의 로그인 세션을 유지할 필요가 없기에

구글 로그인 데이터를 날려버림