# How send data in a token with Next JS

**URL:** <https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [November 14, 2023, 2:37pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865 "2023-11-14T14:37:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rezgui.aziz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezgui.aziz/32/51642_2.png) [@rezgui.aziz](https://community.auth0.com/u/rezgui.aziz)\
**Post date:** [November 14, 2023, 2:37pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865/1 "2023-11-14T14:37:33Z")

</div>

I am using Actions to try and send a username and password within a cookie or maybe a token, I don’t know which best.  
The idea is I have a backend api that required a username and a password then it returns a bearer token to use it to fetch data.  
I was thinking about using Post Logic action to send username and password in a token, then access them in Next js.  
Is is possible? if so how?

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [November 14, 2023, 4:53pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865/3 "2023-11-14T16:53:07Z")

</div>

Hi @rezgui.aziz

Welcome back to the Auth0 Community!

First of all, I wouldn’t recommend sending any form of sensitive data in a token or a cookie. Can you share more details about the use case you want to implement?

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![rezgui.aziz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezgui.aziz/32/51642_2.png) [@rezgui.aziz](https://community.auth0.com/u/rezgui.aziz)\
**Post date:** [November 14, 2023, 5:16pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865/5 "2023-11-14T17:16:15Z")

</div>

Step 1 : A user register then logs in with Auth0  
Step 2: A bearer token needs to be generated from a backend api, it takes a username and a password ( saved on a seperate db).  
Step 3 : I want to save the Bearer & Use it in a secure way.  
Problem : I was hoping , using actions , I could fetch the username & password from db, send it to the user.  
I am using next js, so If handling this would be more suited for a server side API let me know.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [November 14, 2023, 5:34pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865/6 "2023-11-14T17:34:50Z")

</div>

The issue I see that once the password is set on our site it’s can’t be decoded into it’s plain form. Also there’s no option for you to fetch hash or plain password from the Auth0 databases.

---

<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 30, 2023, 7:47pm UTC](https://community.auth0.com/t/how-send-data-in-a-token-with-next-js/120865/7 "2023-11-30T19:47:50Z")

</div>

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