google-api-js-client

How to use the Google API client for JavaScript with a One-Tap sign in flow?

天涯浪子 提交于 2019-12-08 08:03:21
问题 I'm using Google One-Tap sign in to authenticate users, and after the user is authenticated I get an access token. I know that I can use this access token in order to work with the Google API client for JavaScript ("GAPI"). But I can't find any way to work with GAPI using this access token. Is there any way to use GAPI assuming I already have an logged in user? What I'm trying to do is access the user calendar after simply authenticating with One-Tap authentication and giving consent for the

Google logout using api javascript/jquery

耗尽温柔 提交于 2019-12-07 10:27:46
问题 In my web application, I allow users to login using the auth command in the API Client Library but I cannot find a Logout option for the Google API JavaScript Client Library. Can any one suggest how can i Logout of my application as well as google account?? My Login Code is: var OAUTHURL = 'https://accounts.google.com/o/oauth2/auth?'; var VALIDURL = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='; var SCOPE = 'https://www.googleapis.com/auth/userinfo.profile'; var CLIENTID =

gapi.client.load versus google.load

半世苍凉 提交于 2019-12-05 17:36:22
问题 I am confused about how to properly load Google's APIs. I see mentioned two different approaches: First : Google API loader (https://developers.google.com/loader). I see this used like so within the html document: <script src="https://www.google.com/jsapi"></script> Then later in a JS file it gets used like this: google.load('visualization', '1.0', {'packages':['corechart']}) Second : Google API Javascript Client (http://code.google.com/p/google-api-javascript-client/). This one gets loaded

Google logout using api javascript/jquery

笑着哭i 提交于 2019-12-05 17:36:10
In my web application, I allow users to login using the auth command in the API Client Library but I cannot find a Logout option for the Google API JavaScript Client Library. Can any one suggest how can i Logout of my application as well as google account?? My Login Code is: var OAUTHURL = 'https://accounts.google.com/o/oauth2/auth?'; var VALIDURL = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='; var SCOPE = 'https://www.googleapis.com/auth/userinfo.profile'; var CLIENTID = googleAPI; var REDIRECT = redirectUrl; var TYPE = 'token'; var _url = OAUTHURL + 'scope=' + SCOPE + '

Make google auth request gapi.auth without a popup

寵の児 提交于 2019-12-05 06:19:59
Need to make auth request in js but the browser does not support popups. Is there any way to redirect to a new url or show the request in the in html5 page of the application 3pic By using this code check if user authorized your app gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, callbackAuthResult); Note: immediate:true if you set immediate true then it wont show popup. You see? You don't open the popup, and manage the stuff in the callback. This callback is usually used for post-processes. Here we use it for authenticating. in callbackAuthResult :

Unable to get access and refresh token after authenticating with Google API

强颜欢笑 提交于 2019-12-04 14:10:49
I followed this awesome tutorial to get the access and refresh tokens once the user logged in with their google account, but I always this response when I call GetAccessCode() : { "error": "invalid_request" } Here's my code: var url = window.location.href; if (url.indexOf("code=") > 0) { //Once the user signed in with Google var code_starts = url.indexOf("code="); var code = url.substring((code_starts + 5), url.length); alert("Code= " + code); GetAccessTokens(code); } else if (url.indexOf("access_token=") > 0) { //Get the tokens, but I never get this far var at_starts = url.indexOf("access

Google signInCallback called twice when user is signed_out

时光毁灭记忆、已成空白 提交于 2019-12-04 12:14:06
问题 I am using Google Login hybrid flow to authenticate users but I have a strange bug : when users are signed out ( authResult['error'] == 'user_signed_out' ), the signInCallback is called twice ! It does not happen when the user signs in, so I don't think it is linked to the (rather annoying) 'Welcome Back [user]' prompt. My code looks like this : function signInCallback(authResult) { console.log("signIn callback called, using " + authResult['status']['method'] + " method"); console.log(

gapi.client.load versus google.load

最后都变了- 提交于 2019-12-04 03:09:49
I am confused about how to properly load Google's APIs. I see mentioned two different approaches: First : Google API loader ( https://developers.google.com/loader ). I see this used like so within the html document: <script src="https://www.google.com/jsapi"></script> Then later in a JS file it gets used like this: google.load('visualization', '1.0', {'packages':['corechart']}) Second : Google API Javascript Client ( http://code.google.com/p/google-api-javascript-client/ ). This one gets loaded like: <script src="https://apis.google.com/js/client.js"></script> and then used later like: gapi

Google Contacts API with Google JavaScript Client Lib

时光毁灭记忆、已成空白 提交于 2019-12-03 02:01:21
I am trying to work with the Google Contacts API v3 . Because of the OAuth2 authentication and authorization I'm started with the Google APIs Client Library for JavaScript . I have no problems with that part of the API access. But after doing the auth part I don't know what to do next. Can I use the google-api-javascript-client for the Google Contacts API v3? In the list of the supported Google APIs by the javascript-client the contacts API does not appear. But I have full access with the OAuth 2.0 Playground tool . I am really confused which client is working best with the latest Google

Setting search parameters for javascript google drive api

旧街凉风 提交于 2019-12-02 02:59:43
问题 Apologies if this question already exists, i have searched for two days now. I am trying to list all files from google drive root folder which have not been trashed using javascript, this is the code am using function retrieveAllFilesInFolder(folderId, callback) { gapi.client.load('drive', 'v2', function() { var retrievePageOfChildren = function(request, result) { request.execute(function(resp) { result = result.concat(resp.items); var nextPageToken = resp.nextPageToken; if (nextPageToken) {