# Lock v11: getUserInfo does not work with token from "lock.checkSession"

**URL:** <https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158>\
**Category:** JWT.io\
**Tags:** lock\
**Created:** [September 8, 2018, 3:01pm UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158 "2018-09-08T15:01:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dienste](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dienste](https://community.auth0.com/u/dienste)\
**Post date:** [September 8, 2018, 3:01pm UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158/1 "2018-09-08T15:01:31Z")

</div>

Hi,

I’m trying to implement a PopUp login with Lock v11 in my javascript app. It works: I can authorize and get user data. But only on login. If I try to refresh the token with `lock.checkSession()` and use this token to call `lock.getUserInfo()` I get `{"error":"unauthorized","error_description":"invalid credentials"}`. I checked that the request send to `https://restegourmet.eu.auth0.com/userinfo` is the same except the new token.

What could be wrong?

Here is my complete code. O call rg\_auth0.init() on page load.

rg\_auth0 = {  
lock: null,

```
init: function () { 
    this._init_lock();            
    this._init_events();

    this.refresh_token();
},

refresh_token: function () {
    this.lock.checkSession({}, function(err, authResult) {
        if (err) {
            console.log ("checkSession error", err, authResult);
            return;
        }

        rg_auth0._get_user_info(authResult);           
    });       
}, 

show_lock: function () {
    this.lock.show();
},    

_init_lock: function () {
    this.lock = new Auth0Lock(
        php_to_js.AUTH0_CLIENT_ID,
        php_to_js.AUTH0_DOMAIN,
        {
            autoclose: true,
            auth: {
                redirect: false,
                responseType: 'token',
                audience: php_to_js.AUTH0_AUDIENCE
            }
        }
    );
},    

_init_events: function () {
    // Listening for the authenticated event
    this.lock.on("authenticated", function(authResult) {
        rg_auth0._get_user_info(authResult);
    }); 
},

_get_user_info: function (authResult) {
    console.log ("_get_user_info", authResult);

    rg_auth0.lock.getUserInfo(authResult.accessToken, function(error, profile) {
        
        if (error) {
            console.log ("getUserInfo error", error, profile);
            return;
        }

        console.log("getUserInfo success", authResult, profile);
    });
},

```

};

---

<div class="post-metadata">

**Author:** ![melgamal](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/melgamal/32/12906_2.png) [@melgamal](https://community.auth0.com/u/melgamal)\
**Post date:** [September 25, 2018, 4:43am UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158/2 "2018-09-25T04:43:47Z")

</div>

I am facing the same exact issue tike the one above but on an SPA react js app

---

<div class="post-metadata">

**Author:** ![dienste](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dienste](https://community.auth0.com/u/dienste)\
**Post date:** [October 1, 2018, 9:46pm UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158/3 "2018-10-01T21:46:04Z")

</div>

In my case it was related to this issue: [checkSession drops scopes from original lock constructor · Issue #1484 · auth0/lock · GitHub](https://github.com/auth0/lock/issues/1484)

Just add scope parameter to checkSession call or update lock.js to version v10.11.0

---

<div class="post-metadata">

**Author:** ![melgamal](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/melgamal/32/12906_2.png) [@melgamal](https://community.auth0.com/u/melgamal)\
**Post date:** [October 2, 2018, 3:29am UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158/4 "2018-10-02T03:29:22Z")

</div>

will check that tomorrow, but i’m already on lock version 11.9.1

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 20, 2019, 1:18pm UTC](https://community.auth0.com/t/lock-v11-getuserinfo-does-not-work-with-token-from-lock-checksession/15158/5 "2019-08-20T13:18:22Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
