vue-gapi: TypeError: Cannot read property 'access_token' of null
Hi !
First of all, thanks for your great library!
Unfortunatly, when using this.$gapi.login()
i receive the following error :
cb=gapi.loaded_0:181 Uncaught TypeError: Cannot read property 'access_token' of null
at GoogleAuthService._setStorage (vue-gapi.common.js?15fd:83)
at GoogleAuthService._setSession (vue-gapi.common.js?15fd:134)
at eval (vue-gapi.common.js?15fd:155)
at e.Sr (cb=gapi.loaded_0:192)
at Lk (cb=gapi.loaded_0:195)
at Gk (cb=gapi.loaded_0:195)
at _.rk.xU (cb=gapi.loaded_0:195)
at ok (cb=gapi.loaded_0:186)
Looking at the parent method, the response
is almost empty.
The profile info is there :
If i call $gapi.login()
a second time, everything works fine.
Also, if i refresh the page, i am logged in correctly
Thanks for your help, Samuel
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (8 by maintainers)
@everttrollip @sadortun @namoscato @vinicius1209 I have just published the fix: 0.3.1
Kindly check and let me know ā
@cedpoilly, this was introduced with the change from
GoogleAuth.signIn()
toGoogleAuth.grantOfflineAccess()
in https://github.com/cedpoilly/vue-gapi/compare/v0.1.2...v0.2.2:https://github.com/cedpoilly/vue-gapi/blob/8f1c403bce4bb5955a085257bb89a4d63b1b2803/src/VueGAPI/GoogleAuthService.js#L120-L126
In the current state, the subsequent
_setSession
call toGoogleUser.getAuthResponse()
is returningnull
.Iām not sure why that is happening off the top of my head, but why was the change made from
signIn
tograntOfflineAccess
? This seems like a less than ideal default.This also looks good in my context as well ā thanks @cedpoilly! Iām going to close this out.
@everttrollip @sadortun @namoscato @vinicius1209 I have a working prototype. Still needs some fine tuning & testing. Stay tuned š¤
@cedpoilly, no problem! I would be happy to help out when I can, but I cannot commit a ton of time at the moment.