# How to use Resource Owner Password Grant with a session?

**URL:** <https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [April 19, 2024, 12:37pm UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390 "2024-04-19T12:37:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman.r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/roman.r/32/49631_2.png) [@roman.r](https://community.auth0.com/u/roman.r)\
**Post date:** [April 19, 2024, 12:37pm UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390/1 "2024-04-19T12:37:19Z")

</div>

Hi!

I would like to implement a login with email/password on my SPA website.  
I want a user to fill out the form directly on my website and submit it without redirections and popups.

As I understand I should you “Embedded login”. I checked [the docs](https://auth0.com/docs/authenticate/login/embedded-login), it offers me 3 options:

1. Use Lock
2. Use Auth0.js
3. Manullay call Authentication API

As I understand, the only option that fits my needs is the 3d.  
i.e. I should call auth API manually (Resource Owner Password Grant).  
The only problem is that I don’t understand how to keep a user logged in after the access token expires.  
Is there a session involved here so I can request a new access token without asking for user credentials?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 20, 2024, 12:51am UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390/3 "2024-04-20T00:51:59Z")

</div>

Hi there @roman.r !

> [@roman.r](#):
>
> As I understand, the only option that fits my needs is the 3d.  
> i.e. I should call auth API manually (Resource Owner Password Grant).

Can you help me understand why you think calling the API directly is your best approach?

> [@roman.r](#):
>
> Is there a session involved here so I can request a new access token without asking for user credentials?

When using the Auth0 Authentication API directly, you can manage user sessions by leveraging refresh tokens, which allow your application to maintain authentication without needing the user to re-enter credentials.

> **[Refresh Tokens](https://auth0.com/docs/secure/tokens/refresh-tokens)**
>
> Describes how refresh tokens work to allow the application to ask Auth0 to issue a new access token or ID token without having to re-authenticate the user.

> **[What Are Refresh Tokens and How to Use Them Securely](https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/)**
>
> Learn about refresh tokens and how they help developers balance security and usability in their applications.

---

<div class="post-metadata">

**Author:** ![roman.r](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/roman.r/32/49631_2.png) [@roman.r](https://community.auth0.com/u/roman.r)\
**Post date:** [April 20, 2024, 6:44am UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390/4 "2024-04-20T06:44:00Z")

</div>

> [@ty.frith](#):
>
> Can you help me understand why you think calling the API directly is your best approach?

I would like to avoid any redirections and popups on my website. Auth0 Lock has popups and redirects, and Auth0.js has a redirect as well. Only calling API directly (Resource Owner Password Grant) seems to be a perfect solution, because it doesn’t lead to any redirects

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 22, 2024, 10:37pm UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390/5 "2024-04-22T22:37:54Z")

</div>

Gotcha, thanks for clarifying!

---

<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:** [May 6, 2024, 10:38pm UTC](https://community.auth0.com/t/how-to-use-resource-owner-password-grant-with-a-session/132390/6 "2024-05-06T22:38:47Z")

</div>

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