# How to set SAML RelayState in Actions?

**URL:** <https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123>\
**Category:** Get Help\
**Tags:** protocols, saml\
**Created:** [November 17, 2023, 4:36pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123 "2023-11-17T16:36:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliaksei](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@aliaksei](https://community.auth0.com/u/aliaksei)\
**Post date:** [November 17, 2023, 4:36pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/1 "2023-11-17T16:36:07Z")

</div>

Hi,

I’m migrating from Rules to Action Flows.  
Now I’m completely stuck with migrating the following **Rule** code:

```auto
function (user, context, callback) {
   
 // some SAML mapping here
 //...

  context.samlConfiguration.RelayState = "Some Relay State";
  callback(null, user, context);
 
}

```

I can’t find any working way to set **RelayState** parameter that should be returned with SAMLResponse.  
Is this even possible with **Actions**?

Thanks.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 21, 2023, 3:13pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/3 "2023-11-21T15:13:31Z")

</div>

Hi @aliaksei,

Welcome to the Auth0 Community!

I can’t find a definitive answer on this one. I’ll reach out internally and report back. Thanks.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 28, 2023, 1:58pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/5 "2023-11-28T13:58:18Z")

</div>

Hi again @aliaksei,

It sounds like it’s not currently available in Actions. Would you mind sharing a bit about the use case and I can pass it on to our product manager?

---

<div class="post-metadata">

**Author:** ![aliaksei](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@aliaksei](https://community.auth0.com/u/aliaksei)\
**Post date:** [November 28, 2023, 2:05pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/6 "2023-11-28T14:05:52Z")

</div>

Hi @dan.woda,

Sure, the use case is pretty simple and is described here [Using Auth0 with Microsoft Active Directory on Amazon AppStream 2.0 | Desktop and Application Streaming](https://aws.amazon.com/blogs/desktop-and-application-streaming/using-auth0-with-ad-on-amazon-appstream-2-0/)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 28, 2023, 2:10pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/7 "2023-11-28T14:10:47Z")

</div>

That’s perfect, thanks for the link!

---

<div class="post-metadata">

**Author:** ![william.booth](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@william.booth](https://community.auth0.com/u/william.booth)\
**Post date:** [December 8, 2023, 1:59pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/9 "2023-12-08T13:59:21Z")

</div>

This is also a blocker for us, with the same use case, if that boosts the priority at all.

---

<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:** [December 22, 2023, 5:58pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/10 "2023-12-22T17:58:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [November 11, 2025, 5:18pm UTC](https://community.auth0.com/t/how-to-set-saml-relaystate-in-actions/121123/11 "2025-11-11T17:18:02Z")

</div>

This can be accomplished with Actions using `api.samlResponse.setRelayState(relayState)`.

You can find the documentation [here](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-api-object?_gl=1*13tziog*_gcl_aw*R0NMLjE3NjE3NTE0NTYuQ2owS0NRanc5b2JJQmhDQUFSSXNBR0htMW1US0hJVHIwdkJ1NjdQMUxLdHdkUmZkNVVqcXJqWlRJMzY3aVdrTDdZTkNBZE1QM255czlmVWFBbXZWRUFMd193Y0I.*_gcl_au*MTgyOTcyOTM1NS4xNzU4MDY1NjUz*_ga*MTY4Njc4OTY3My4xNzQyNDkwMjAy*_ga_QKMSDV5369*czE3NjI4NzQ3MjgkbzY0JGcxJHQxNzYyODgxMTkyJGo0MiRsMCRoMA).

Thank you @ericulley for letting us know about this!

Kind Regards,  
Nik
