Bandz
Bandz

Reputation: 265

Azure B2C - Pass Parameter via URL to ClaimType to Claim in Token

I want to pass a parameter via the request URL to B2C and then be able to send this out as a claim in the access token. I am guessing I will need to capture this in a claimType. How do I go about this?

Thanks!

Upvotes: 4

Views: 4879

Answers (1)

Brad C.
Brad C.

Reputation: 612

You can capture query string parameters using a Claims Resolver.

https://learn.microsoft.com/en-us/azure/active-directory-b2c/claim-resolver-overview#oauth2-key-value-parameters

For example, if you would like to capture the ?bandz=test query string parameter, you could resolve that via the {OAUTH-KV:bandz} claims resolver.

In your <RelyingParty>'s output claims, you could then refer to a claim and the value like this:

<OutputClaim ClaimTypeReferenceId="customClaimId" AlwaysUseDefaultValue="true" DefaultValue="{OAUTH-KV:bandz}" />

You would just need a Claim definition for customClaimId.

Upvotes: 8

Related Questions