# Best way to implement embedded login with session management?

**URL:** <https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774>\
**Category:** Get Help\
**Tags:** auth0js, nextjs\
**Created:** [September 16, 2022, 11:24am UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774 "2022-09-16T11:24:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas.dagar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vikas.dagar/32/33660_2.png) [@vikas.dagar](https://community.auth0.com/u/vikas.dagar)\
**Post date:** [September 16, 2022, 11:24am UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774/1 "2022-09-16T11:24:12Z")

</div>

Please include the following information in your post:

- Which SDK this is regarding:
- SDK Version: 9.19.1
- Platform Version: JavaScript
- Code Snippets/Error Messages/Supporting Details/Screenshots:

We are developing embedded login. we didn’t find any good reference. currently we are using webAuth login and then checking session using checkSession. we are going right direction?. if so how can we manage session and accessToken etc. api reference is not straight forwarded.

Please suggest us any good reference or flow to manage session and login.

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [September 16, 2022, 1:08pm UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774/2 "2022-09-16T13:08:46Z")

</div>

Hi @vikas.dagar

With embedded login, there is no session. You don’t open a browser (for OIDC or SAML), so there is no browser cookie, which is the session.

I’d recommend not using embedded login and using Auth Code or Auth Code + PKCE

John

---

<div class="post-metadata">

**Author:** ![vikas.dagar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vikas.dagar/32/33660_2.png) [@vikas.dagar](https://community.auth0.com/u/vikas.dagar)\
**Post date:** [September 19, 2022, 10:56am UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774/3 "2022-09-19T10:56:51Z")

</div>

Hello John,

thank you so much for your email. I looked into your response to use Auth Code + PKCE but this is require to send OTP verification to verify the email with the code

in our case, we just allow user to login with the username and password ( no authentication code). So, I think its not going to work

I will be using embedded login with refresh token which seems fulfill my requirements

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [September 19, 2022, 1:38pm UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774/4 "2022-09-19T13:38:18Z")

</div>

Hi @vikas.dagar

You can use either Auth Code, or Auth Code + PKCE

Neither one uses OTP verification. They do use a “code” to exchange for the tokens, but this code is handled entirely by the protocol, it is invisible to the user.

I still recommend switching to OIDC or SAML.

John

---

<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:** [November 20, 2024, 9:27pm UTC](https://community.auth0.com/t/best-way-to-implement-embedded-login-with-session-management/90774/5 "2024-11-20T21:27:34Z")

</div>

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