Machine to Machine Custom Claim

Hi,

Using the machine to machine flow. I want to be able to add a custom claim that identifies a customer. I see how to do this in the web portal. However this will be very cumbersome if we have to add custom claims to potentially hundreds of m2m applications. Is there a way to do this using the management api so this can be automated? I have searched through the documentation and community postings but cannot find anything.

I see this documented for the web login flow, but not for M2M.

Regards,

Chris

I think I might be able to answer my own question. I added a custom action in the M2M flow that returned the client id in the token as a custom claim.

exports.onExecuteCredentialsExchange = async (event, api) => {
  api.accessToken.setCustomClaim("https://lightspeedautomation.com/client-id", event.client.client_id);  
};

I can use the client id as a tenant id. Alternatively, I think I could of created my own tenant id as client_metadata and used that.

1 Like

Hey there @chris.markwick !

That’s exactly how I’d recommend adding a custom claim, glad you were able to get this sorted! :slight_smile:

1 Like

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