Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 602
Bandz Avatar asked Oct 29 '25 15:10

Bandz


1 Answers

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.

like image 76
Brad C. Avatar answered Oct 31 '25 13:10

Brad C.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!