Hi @Gnana Sekhar , yes this should be possible.
Here are the high-level steps to implement this use case:
- In your sign-in or sign-up custom policy, add a technical profile to issue a JWT token. You can use the
JwtIssuer
technical profile for this purpose. Make sure to include the necessary claims in the token, such as the user's object ID and any custom attributes you need to pass to the REST API. - In your REST API, configure it to accept the JWT token as a bearer token and validate it. You can use the
JwtIssuer
technical profile to issue the token, so you can be sure that it is a valid token. - In your B2C custom policy, add a REST technical profile to call your REST API. In the
AuthenticationType
element, set the value toBearer
. In theBearerToken
element, set the value to{OIDC:JWT}
. This will use the JWT token issued by theJwtIssuer
technical profile as the bearer token for the REST API call.
For example:
<TechnicalProfile Id="CallRestApi">
<DisplayName>Call REST API</DisplayName>
<Protocol Name="REST" />
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="ServiceUrl">https://your-rest-api-url</Item>
<Item Key="AuthenticationType">Bearer</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="BearerToken">{OIDC:JWT}</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="id" />
<InputClaim ClaimTypeReferenceId="yourCustomAttribute" PartnerClaimType="yourCustomAttribute" />
</InputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
Note that you need to configure your REST API to accept the JWT token as a bearer token and validate it. You can use the JwtIssuer
technical profile to issue the token, so you can be sure that it is a valid token. You also need to make sure that the necessary claims are included in the token.
Please let me know if you have any questions and I can help you further.
If this answer helps you please mark "Accept Answer" so other users can reference it.
Thank you,
James