# Embedded Login flow with NextJs 14

**URL:** <https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [July 22, 2024, 4:53pm UTC](https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445 "2024-07-22T16:53:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackwilder28](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@jackwilder28](https://community.auth0.com/u/jackwilder28)\
**Post date:** [July 22, 2024, 4:53pm UTC](https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445/1 "2024-07-22T16:53:27Z")

</div>

I have embedded setup with auth0-js in my NextJs application (app router). Integrated authentication flows as described in the auth0-js docs and everything works properly. But, all the authentication process are done in the client components. I want to integrate auth in the server session like next-auth to improve security. Is there a way to integrate auth0-js with next-auth? Or, how can I implement auth in the server components. Please help nerds.

---

<div class="post-metadata">

**Author:** ![tmarshall](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tmarshall/32/59177_2.png) [@tmarshall](https://community.auth0.com/u/tmarshall)\
**Post date:** [August 13, 2024, 12:17am UTC](https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445/2 "2024-08-13T00:17:06Z")

</div>

Can I ask how you did the emdedded authentication? Are you using username/password? How do you handle verifying access tokens and what not?

---

<div class="post-metadata">

**Author:** ![calebpdx](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/calebpdx/32/72977_2.png) [@calebpdx](https://community.auth0.com/u/calebpdx)\
**Post date:** [February 17, 2025, 5:57am UTC](https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445/3 "2025-02-17T05:57:19Z")

</div>

This is actually a pretty standard flow with any authentication platform. The standard way is to get the session object and pass the token to a server action. You can then use that token in a fetch authorization bearer token to your backend. If you are using a ORM, you can use the email address or the auth0 id and just match it up to the user.

---

<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:** [March 4, 2025, 12:57pm UTC](https://community.auth0.com/t/embedded-login-flow-with-nextjs-14/139445/5 "2025-03-04T12:57:20Z")

</div>

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