# Actions - How to sign JWT with RS256?

**URL:** <https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920>\
**Category:** Get Help\
**Tags:** jwt, rsa256, encoding\
**Created:** [June 10, 2022, 3:49am UTC](https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920 "2022-06-10T03:49:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![k.lee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/k.lee/32/33786_2.png) [@k.lee](https://community.auth0.com/u/k.lee)\
**Post date:** [June 10, 2022, 3:49am UTC](https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920/1 "2022-06-10T03:49:37Z")

</div>

I’m using a post-login action redirect and attempting to send a session\_token as a query param to the redirect URL. With HS, you could use `api.redirect.encodeToken` while passing in a secret, but what is the equivalent for RS?

When using RS for signatures, it seems that Auth0 handles the private key and signs tokens. If I omit the `secret` option for `api.redirect.encodeToken`, I get an error in the browser saying: `access_denied (secret must be a string or bufferor a KeyObject)`.

How can I sign and send a session\_token along with my redirect during the action flow?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 10, 2022, 8:00pm UTC](https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920/3 "2022-06-10T20:00:05Z")

</div>

Hi @k.lee,

Thanks for reaching out to the Auth0 Community!

I understand that you would like to change the signing algorithm for your JWT Web Token.

It seems like you may need to [change your signing algorithm on your Application](https://auth0.com/docs/get-started/applications/change-application-signing-algorithms) settings from HS256 to RS256. To do so, I recommend checking that your Application settings have set the _JSON Web Token (JWT) Signature Algorithm_ to RS256 under the **Advanced Settings** at the bottom of the page. Please do not forget to save your changes.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/b/3/b33c4e40ab4b574c632f43174a221c4a67073d24.jpeg)

Moreover, if you are making a login request with an API as the audience, I suggest checking that your **Signing Algorithm** is configured to RS256.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/6/c6a978d2d5cdd3cc3edc4e619879da8990149560.png)

Then once this is complete, your application is configured to sign the JSON web token with the RS256 algorithm.

Please let me know how this goes for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![k.lee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/k.lee/32/33786_2.png) [@k.lee](https://community.auth0.com/u/k.lee)\
**Post date:** [June 10, 2022, 10:34pm UTC](https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920/4 "2022-06-10T22:34:10Z")

</div>

Thanks for the response!

My application is already configured to use RS256 signing algorithm. My issue was using `api.redirect.encodeToken` when my application is set to use RS256 - however, it seems that this method uses HS256 by default.

Everything works on my end now! Originally, it was unclear whether I had to use an RS256 signing algorithm for this api method.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 22, 2022, 10:51am UTC](https://community.auth0.com/t/actions-how-to-sign-jwt-with-rs256/84920/5 "2022-12-22T10:51:27Z")

</div>


