Auth0 Home Blog Docs

How to use checkSession?

auth0js

#1

I’m trying to use checkSession(auth0js v9) but I couldn’t make it work.

I get 400 then timeout error.

checkSession() {
    let _this = this
    return new Promise((resolve, reject) => {
        _this.auth.checkSession({
            "audience": "https://domain.auth0.com/userinfo",
            "scope": "openid profile",
        }, (err, authResult) => {
            if (err)
                reject(err)
            resolve(authResult)
        })
    })
}

#2

If you inspect the response using the browser network tools of the HTTP request that resulted in a 400 then you would likely obtain additional information about the root cause. Without more information I would guess you failed to correctly configure the client application to allow for checkSessiontype of requests; in particular, you would need to correctly configure the allowed web origins settings to contain the web origin from which you are starting the request.


#3