# Is there any to set the user session manually

**URL:** <https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400>\
**Category:** Get Help\
**Tags:** api, sso, management-api, login, auth0\
**Created:** [December 27, 2018, 7:07am UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400 "2018-12-27T07:07:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SunnySharma](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sunnysharma/32/9077_2.png) [@SunnySharma](https://community.auth0.com/u/SunnySharma)\
**Post date:** [December 27, 2018, 7:07am UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400/1 "2018-12-27T07:07:49Z")

</div>

We have a SPA where the user goes to Auth0 hosted login page, enters email/password and on successful authentication he gets redirected to the SPA back.

The SPA checks for token and it’s validity along with session on Auth0 (_using WebAuth.checkSession() method in Auth0 client library_). This flow is working fine.

Now we want to authenticate the user from backend and get access-token using **password grant** and redirect him to the SPA - with access\_token/id\_token and other parameters.

The access\_token validation passes here but the **checkSession()** fails.

Is there any way to set the user session on Auth0 manually??

TIA,  
Sunny

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [December 27, 2018, 2:51pm UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400/3 "2018-12-27T14:51:12Z")

</div>

Hey there @SunnySharma, can you check to make sure that you are not passing a empty object to `checkSession()` ? When you get a chance can you snag a HAR file of the entire initial login and the call the `checkSession` and DM it over to me so I can take deeper look at what’s going on? Thanks in advance!

> **[Generate and Analyze HAR Files](https://auth0.com/docs/troubleshoot/troubleshooting-tools/generate-and-analyze-har-files)**
>
> Learn how to troubleshoot with HAR files and steps to generate a HAR file.

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [January 8, 2019, 2:21pm UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400/4 "2019-01-08T14:21:44Z")

</div>

I spent some time working with our support team @SunnySharma and reviewing your HAR file capture. We were able to conclude due to the fact CheckSession() method calls /authorize endpoint to get a new token by passing `prompt:none` and you are using resource owner password grant to get a token from your backend, there would be no session for the browser flow which would result in checkSession() failing.

Also there is no way to establish a session in the authorization server manually. It requires a user to authenticate successfully to generate the session.Thank you.

---

<div class="post-metadata">

**Author:** ![SunnySharma](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sunnysharma/32/9077_2.png) [@SunnySharma](https://community.auth0.com/u/SunnySharma)\
**Post date:** [January 8, 2019, 4:55pm UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400/5 "2019-01-08T16:55:26Z")

</div>

Thank you so much @James.Morrison for looking into it. I had a call with the technical team as well and @jamie.hughes confirmed the same. There’s no way to add a session manually.

I’ll have to figure another way to go. I appreciate the time you both spent looking into it. Thanks!

---

<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:** [February 7, 2019, 4:55pm UTC](https://community.auth0.com/t/is-there-any-to-set-the-user-session-manually/19400/6 "2019-02-07T16:55:30Z")

</div>

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