Error "g is null" with gapi.auth.authorize()

229 views
Skip to first unread message

P THE AWESOME

unread,
Nov 29, 2015, 12:59:52 AM11/29/15
to Google API JavaScript Client
I was following the instructions on the Google Developers Guide at How to use CORS to access Google APIs, but I got an error "g is null" when running gapi.auth.authorize().

My relevant HTML code:
<script src="https://apis.google.com/js/api.js" type="text/javascript"></script>
Relevant JavaScript (this is inside of an AngularJS runBlock, but that should have no affect on it):
gapi.load('auth', function() {
  gapi
.auth.authorize({
    client_id
: 'MYAPIKEY',       // I substituted my API key here
    immediate
: false,
    response_type
: 'token'
 
}, function(access_token) {
    console
.debug(access_token);
 
});
});
The full error:
Error: g is null
Mw@https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:503:153
fx@https
://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:516:189
gx@https
://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:518:107
_
.hx/f<@https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:519:98
_
.C@https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:46:297
_
.hx@https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_0:519:26
runBlock
/<@http://localhost:3000/app/index.run.js:31:1
Y
/r[t]/b/<@https://apis.google.com/js/client.js:7:333
G@https
://apis.google.com/js/client.js:1:847
Y
/r[t]/b@https://apis.google.com/js/client.js:7:317
Y
/r[t]@https://apis.google.com/js/client.js:7:412
Y
/D[I]@https://apis.google.com/js/client.js:7:470
@https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.2fBtQxvw4Wo.O/m=auth/exm=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCM8bBsfEIrg3a-I6L5AIr3WcEtegg/t=zcms/cb=gapi.loaded_1:1:10

Thanks for any help!

P THE AWESOME

unread,
Nov 29, 2015, 1:52:58 AM11/29/15
to Google API JavaScript Client
I was missing a scope. Problem solved!
Reply all
Reply to author
Forward
0 new messages