# How to pass data generated on login in SAML assertion?

**URL:** <https://community.auth0.com/t/how-to-pass-data-generated-on-login-in-saml-assertion/94744>\
**Category:** Get Help\
**Tags:** rules-management-api, management-api\
**Created:** [November 19, 2022, 7:37am UTC](https://community.auth0.com/t/how-to-pass-data-generated-on-login-in-saml-assertion/94744 "2022-11-19T07:37:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avii](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/avii/32/41108_2.png) [@avii](https://community.auth0.com/u/avii)\
**Post date:** [November 19, 2022, 7:37am UTC](https://community.auth0.com/t/how-to-pass-data-generated-on-login-in-saml-assertion/94744/1 "2022-11-19T07:37:25Z")

</div>

Hi,

I’m really struggling to understand how I am supposed to customize SAML assertions on user login.

I get that I can map user attributes to a particular SAML parameter both in the add-on settings and via rules. However, _I need to generate a token from my api during either an action or rule on login and pass its value via SAML_. I have learned I cannot do this by storing the token in app\_metadata as the patch to the metadata will not go through until after the saml assertions are generated. How am i supposed to send custom parameters via saml on login that are not static attributes in the users profile? Again, mapping a pre-existing attribute is not what i’m looking for here–i’m trying to send custom information that is generated on log in.

Thanks for any help you can give

Avi

---

<div class="post-metadata">

**Author:** ![david\_wisecarver](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david_wisecarver/32/37472_2.png) [@david\_wisecarver](https://community.auth0.com/u/david_wisecarver)\
**Post date:** [December 8, 2022, 9:54pm UTC](https://community.auth0.com/t/how-to-pass-data-generated-on-login-in-saml-assertion/94744/2 "2022-12-08T21:54:42Z")

</div>

Hi @avii,

Rules will run sequentially in the order that you have them configured in your tenant, so you should be able to update the user’s app\_metadata in the first rule that runs, and then have a second rule run after that to include that app\_metadata in the SAML Assertion.

Here are some additional resources from our docs on this as well:

> **[Manage Metadata with Rules](https://auth0.com/docs/manage-users/user-accounts/metadata/manage-metadata-rules#update-app-metadata)**
>
> Learn how to manage with app metadata, user metadata, and client metadata using Rules.

> **[Customize SAML Assertions](https://auth0.com/docs/authenticate/protocols/saml/saml-configuration/customize-saml-assertions#example-include-user_metadata-attributes-in-an-assertion)**
>
> Describes how to customize SAML assertions and the SAML and WS-Fed protocol parameters.

---

<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:** [January 10, 2023, 12:13pm UTC](https://community.auth0.com/t/how-to-pass-data-generated-on-login-in-saml-assertion/94744/3 "2023-01-10T12:13:28Z")

</div>

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