# Setting up the Session Cookie on User's Browser

**URL:** <https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628>\
**Category:** Questions\
**Created:** [October 17, 2019, 3:10pm UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628 "2019-10-17T15:10:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaynishp](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jaynishp](https://devforum.okta.com/u/jaynishp)\
**Post date:** [October 17, 2019, 3:10pm UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/1 "2019-10-17T15:10:27Z")

</div>

Hello,  
I am trying to figure out the solution to create a cookie on the user’s browser using Session Token received by calling the Authentication API from my .Net MVC application.

I m trying to use this method for setting up the cookie in User’s browser.  
" Retrieving a session cookie via OpenID Connect Authorization Endpoint"  
[https://developer.okta.com/docs/guides/session-cookie/overview/#retrieving-a-session-cookie-via-openid-connect-authorization-endpoint](https://developer.okta.com/docs/guides/session-cookie/overview/#retrieving-a-session-cookie-via-openid-connect-authorization-endpoint)

The request syntax is:  
https://$XXXXXXX.oktapreview.com/oauth2/v1/authorize?client\_id={clientId}&response\_type=id\_token&scope=openid&prompt=none&redirect\_uri=https%3A%2F%2Fyour-app.example.com&state=Af0ifjslDkj&nonce=n-0S6\_WzA2Mj&sessionToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Can someone please advise or share a sample code which does this ?  
My application is MVC .Net application.

I would like to achieve 2 things.

1. Set the cookie in the User’s browser for SSO purpose
2. Validate the login Session on all the pages of the application until User is logged in.

Thank you in advance for your time.

---

<div class="post-metadata">

**Author:** ![eddienguyen123](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/eddienguyen123/32/1402_2.png) [@eddienguyen123](https://devforum.okta.com/u/eddienguyen123)\
**Post date:** [October 21, 2019, 3:13am UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/2 "2019-10-21T03:13:17Z")

</div>

We can help you!  
Please visit [https://co-well.vn](https://co-well.vn)

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [October 21, 2019, 10:33am UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/3 "2019-10-21T10:33:11Z")

</div>

Hi @jaynishp

You can also check [https://github.com/okta/samples-aspnet/tree/master/self-hosted-login](https://github.com/okta/samples-aspnet/tree/master/self-hosted-login)

---

<div class="post-metadata">

**Author:** ![jaynishp](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jaynishp](https://devforum.okta.com/u/jaynishp)\
**Post date:** [October 22, 2019, 2:50pm UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/4 "2019-10-22T14:50:15Z")

</div>

Hi @eddienguyen123,  
This link is not working. Can you please check?

Thanks

---

<div class="post-metadata">

**Author:** ![jaynishp](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jaynishp](https://devforum.okta.com/u/jaynishp)\
**Post date:** [October 22, 2019, 2:51pm UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/5 "2019-10-22T14:51:02Z")

</div>

Hi @dragos,  
Thank you for sharing this. We will look into this and will get back to you if any questions.

---

<div class="post-metadata">

**Author:** ![eddienguyen123](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/eddienguyen123/32/1402_2.png) [@eddienguyen123](https://devforum.okta.com/u/eddienguyen123)\
**Post date:** [October 29, 2019, 3:17am UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/6 "2019-10-29T03:17:38Z")

</div>

Hi @jaynishp, please try again, our site is now available! Thank you so much!

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 18, 2024, 12:26am UTC](https://devforum.okta.com/t/setting-up-the-session-cookie-on-users-browser/6628/7 "2024-01-18T00:26:17Z")

</div>

Closed on January 18, 2024, 12:26am UTC


