FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Lambda - Augment JWT with client_credentials/M2M flow

    Scheduled Pinned Locked Moved Unsolved
    General Discussion
    2
    2
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      williamjeanmireault
      last edited by

      Hi,

      We've recently started exploring the migration from Auth0 to FusionAuth, and I was wondering if there's a way to read the body of a request using a Lambda. In Auth0, the equivalent would be an Action with the onExecuteCredentialsExchange, which includes the event parameter that allows us to access the request body.

      I noticed that the client credentials Lambda structure in FusionAuth has four arguments: jwt, recipientEntity, targetEntities, and permissions. However, we need to augment the JWT claims with a value passed in the body of the client credentials grant request.

      Is there a way to achieve this?

      Thanks!

      joshuaJ 1 Reply Last reply Reply Quote 0
      • joshuaJ
        joshua @williamjeanmireault
        last edited by

        @williamjeanmireault

        It sounds like you would like to be able to read state or similar in a lambda (we don't currently allow this)

        In a populate lambda, you do have access to

        • Entity Data (https://fusionauth.io/docs/apis/entities/entities) (entity.data)
          This means that you can set any custom field you would like on your entity and use that in a populate worklfow
        • .fetch() https://fusionauth.io/docs/extend/code/lambdas/#using-lambda-http-connect

        So you could access custom data attributes or call out to another system in the lambda

        If you have access to a support contract, you can also log a support ticket if you would like or open a feature request outlining your requirements
        https://fusionauth.io/docs/operate/troubleshooting/technical-support

        1 Reply Last reply Reply Quote 0
        • First post
          Last post