question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'access_token' of null

See original GitHub issue

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.

image

The profile info is there : image

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
cedpoillycommented, Jun 6, 2020

@everttrollip @sadortun @namoscato @vinicius1209 I have just published the fix: 0.3.1

Kindly check and let me know ✌

2reactions
namoscatocommented, May 30, 2020

@cedpoilly, this was introduced with the change from GoogleAuth.signIn() to GoogleAuth.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 to GoogleUser.getAuthResponse() is returning null.

I’m not sure why that is happening off the top of my head, but why was the change made from signIn to grantOfflineAccess? This seems like a less than ideal default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read properties of null (reading 'accessToken') - Stack ...
I tried to implement the logout feature on the admin page which wasn't done in the tutorial. I grabbed the currentUser in the...
Read more >
Cannot read property 'accessToken' of undefined" for any DB ...
Whenever I try to connect, I get the error "TypeError: Cannot read property 'accessToken' of undefined". However, I can connect to the s......
Read more >
TypeError: Cannot read property 'accessToken' of null
My React app is returning : TypeError: Cannot read property 'accessToken' of null when tring to open the app without accessToken in the...
Read more >
Cannot read property 'accessToken' of null when accessing ...
I'm getting an error "Uncaught TypeError: Cannot read property 'accessToken' of null" when I try to search in suggest control in web entry....
Read more >
Cannot read property 'name' of undefined" laravel passport
Please I need a help . when i want to generate the access Token .i had this error [Vue warn]: Error in render:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found