Skip to content

Commit 03a7017

Browse files
committed
bah
1 parent d7625c9 commit 03a7017

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

‎v3/js/composingprograms.js‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,27 @@ function signinCallback(authResult) {
151151
* Calls the OAuth2 endpoint to disconnect the app for the user.
152152
*/
153153
function signout() {
154-
// Revoke the access token.
155-
$.ajax({
156-
type: 'GET',
157-
url: 'https://accounts.google.com/o/oauth2/revoke?token=' +
158-
gapi.auth.getToken().access_token,
159-
async: false,
160-
contentType: 'application/json',
161-
dataType: 'jsonp',
162-
success: function(result) {
163-
$('#signinButton').show();
164-
$('#loggedInDiv').hide();
165-
},
166-
error: function(e) {
167-
console.log(e);
168-
}
169-
});
154+
var tok = gapi.auth.getToken();
155+
if (tok) {
156+
// Revoke the access token.
157+
$.ajax({
158+
type: 'GET',
159+
url: 'https://accounts.google.com/o/oauth2/revoke?token=' +
160+
tok.access_token,
161+
async: false,
162+
contentType: 'application/json',
163+
dataType: 'jsonp',
164+
success: function(result) {
165+
$('#signinButton').show();
166+
$('#loggedInDiv').hide();
167+
},
168+
error: function(e) {
169+
console.log(e);
170+
}
171+
});
172+
}
173+
else {
174+
$('#signinButton').show();
175+
$('#loggedInDiv').hide();
176+
}
170177
}

0 commit comments

Comments
 (0)