setAuthAppMetadataStep - Medusa Core Workflows Reference

This documentation provides a reference to the setAuthAppMetadataStep. It belongs to the @medusajs/medusa/core-flows package.

This step sets the app_metadata property of an auth identity. This is useful to associate a user (whether it's an admin user or customer) with an auth identity that allows them to authenticate into Medusa.

You can learn more about auth identites in this documentation.

To use this for a custom actor type, check out this guide that explains how to create a custom manager actor type and manage its users.

Example#

To associate an auth identity with an actor type (user, customer, or other actor types):

Code
1const data = setAuthAppMetadataStep({2  authIdentityId: "au_1234",3  actorType: "user", // or `customer`, or custom type4  value: "user_123"5})

To remove the association with an actor type, such as when deleting the user:

Code
1const data = setAuthAppMetadataStep({2  authIdentityId: "au_1234",3  actorType: "user", // or `customer`, or custom type4  value: null5})

Input#

SetAuthAppMetadataStepInputSetAuthAppMetadataStepInput
authIdentityIdstring
actorTypestring
valuestring | null

Output#

AuthIdentityDTOAuthIdentityDTO
The auth identity details.
idstring
The ID of the auth identity.
provider_identitiesProviderIdentityDTO[]Optional
The list of provider identities linked to the auth identity.
app_metadataRecord<string, unknown>Optional
Holds information related to the actor IDs tied to the auth identity.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break