Tag: 谷歌 的OAuth

OAuth2无法在IE9上运行

在Chrome / FF中,以下示例正常,但IE9中存在问题。 var clientId = ‘XXXXXXXXX.apps.googleusercontent.com’; var apiKey = ‘XXXXXXXX_XXXXXXXXXXXXXXXh1o’; var scopes = ‘https://www.googleapis.com/auth/calendar’; function handleClientLoad() { $(“.modal”).show(); gapi.client.setApiKey(apiKey); window.setTimeout(checkAuth, 1); } function checkAuth() { gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: true }, handleAuthResult); } function handleAuthResult(authResult) { var authorizeButton = document.getElementById(‘authorize-button’); if (authResult) { authorizeButton.style.visibility = ‘hidden’; showPanel(); } else { authorizeButton.style.visibility = […]

Google使用Javascript API登录而不触发弹出窗口

我使用以下代码让用户能够通过Javascript API使用他们的Google帐户登录。 HTML Login using Google 使用Javascript function gPOnLoad(){ // G+ api loaded document.getElementById(‘gp_login’).style.display = ‘block’; } function googleAuth() { gapi.auth.signIn({ callback: gPSignInCallback, clientid: googleKey, cookiepolicy: “single_host_origin”, requestvisibleactions: “http://schema.org/AddAction”, scope: “https://www.googleapis.com/auth/plus.login email” }) } function gPSignInCallback(e) { if (e[“status”][“signed_in”]) { gapi.client.load(“plus”, “v1”, function() { if (e[“access_token”]) { getProfile() } else if (e[“error”]) { console.log(“There was […]