gapi

Google Authentication/Gapi: Uncaught TypeError: Cannot read property 'postMessage' of null

别来无恙 提交于 2019-12-24 08:22:29
问题 Good day to everyone! I'm creating a web app using Angular.js 1.5 , Google Authentication (gapi) and UI router . My main goal is to initialize GoogleUser at the first place, using resolve method from the main abstract state: $stateProvider .state('app', { url:'/', templateUrl: 'layout/app-view.html', resolve: { googleAuth: function (User:UserService) { return User.initCurrent(); } } }); which at that point works pretty well - it injects UserService , and call its initCurrent() method, that

Change detection doesn't run when loading auth2 from Google API

不想你离开。 提交于 2019-12-24 00:09:34
问题 I'm trying to load the script https://apis.google.com/js/api.js?onload=initGapi from within an Angular 2 service in order to make calls to the Google API, but whenever I try to return a value when the script is done loading and initializing, the async pipe doesn't want to render the value to the template. I'm using an EventEmitter that fires when the gapi.load() and gapi.client.init is complete, and the observable is subscribed to it in a component. The async pipe doesn't seem to want to read

Sheets JavaScript API Uncaught Error

醉酒当歌 提交于 2019-12-23 04:51:35
问题 I'm playing around with the new version of the Google Sheets API in my Aurelia application (I'm using TypeScript). I've managed to login the user and ask for the required scopes but when I'm trying to get the values of a spreadsheet the API throws the following error: cb=gapi.loaded_0:269 Uncaught Error: arrayForEach was called with a non array value(…) This is how I initialize the API and login the user: gapi.load("auth2", () => { gapi.auth2.init({ 'client_id': this.clientId, 'scope': this

Access scope data after Firebase authentication

女生的网名这么多〃 提交于 2019-12-22 09:28:29
问题 I authorized the calendar api in my google sign in auth, using the following code (Angularfire2): let auth = new firebase.auth.GoogleAuthProvider(); auth.addScope('https://www.googleapis.com/auth/calendar'); this.afAuth.auth .signInWithPopup(auth).then((data) => { console.log(data); // nothing about calendar here }); Is there any way to access authorized scopes using FirebaseAuth? For example, access the calendar data after the user signs and authorizes the calendar auth. 回答1: If you check

Google Drive API in Angular2/Ionic2 gapi.client.drive

心不动则不痛 提交于 2019-12-21 21:37:39
问题 I write Angular2/Ionic2 app to show list and upload file to Google Drive. Login with Google works fine but gapi.client.drive got undefined. What should I do to solution it or have method instead? I installed npm install --save @types/gapi npm install --save @types/gapi.auth2 And my code home.ts import { Component, NgZone } from '@angular/core'; import { NavController } from 'ionic-angular'; import { Http, Headers } from '@angular/http'; import { DriveService } from '../../services/drive

Import gapi.auth2 in angular 2 typescript

放肆的年华 提交于 2019-12-17 10:39:04
问题 I tried to import some classes or function from Google gapi.auth2 in typescript. But below code never works even I correctly added the gapi.auth2 types in typings directory. import { GoogleAuth } from 'gapi.auth2'; I always got error: Error TS2307: Cannot find module 'gapi.auth2' Shall I use some relative directory searching, such as '../../typings/gapi.auth2'? Or maybe the way I am using the gapi is totally wrong? Thanks! 回答1: To use gapi and gapi.auth with Angular2, install the type script

Angular Js and google api client.js (gapi)

家住魔仙堡 提交于 2019-12-17 06:29:52
问题 It took me one day to make it works so I think my experience may be useful from someone. And maybe some others will find improvement. So I start angularJS two days ago. And I want it works with Google Cloud Endpoints to create a backend interface. Here comes the trouble for me. The javascript client for gapi comes with asynchronous loading, so angular initialization will crash having gapi undefined. So you need to bootstrap angular when gapi is initialized: remove ng-app="myApp" Add <script

Trying to understand scope on angular 5 .then

可紊 提交于 2019-12-13 17:17:07
问题 On this example, the promise that i created works ok. But the promise from the google api don't work. It says that the this.youtube is undefined index.html <script src="https://apis.google.com/js/api.js"></script> app.component.html <button (click)="customClick()">custom Promise</button> <hr> <hello name="{{ youtube }}"></hello> <button (click)="youtubeClick()">youtube Promise</button> app.component.ts import { Component } from '@angular/core'; import { } from '@types/gapi.client.youtube';

ReferenceError: gapi is not defined

风格不统一 提交于 2019-12-13 03:49:31
问题 SO i am new at this what i am trying to do is using Angular as Front-end to make a simple button that when clicked asks for user to Authenticate just like any login using gmail example but i keep getting this error and here is my code what i am trying to do is use the code provided by google https://developers.google.com/gmail/api/v1/reference/users/messages/list and covert it to typescript app.component.ts export class AppComponent { async authenticate() { return await gapi.auth2

Disable gmail api request caching

谁都会走 提交于 2019-12-12 09:56:21
问题 I am using javascript gmail api to fetch email threads using threadId. I am using the following code: var request = gapi.client.gmail.users.threads.get({ 'userId': 'me', 'id': '123abc' }); request.execute(function(response) { var messages = response.messages; }); For the first time for a particular threadId it's working fine. And for further requests its returning the same number of messages even if the thread has more emails. But the response gives correct number of emails if I am clearing