MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.26k stars 21.43k forks source link

Azure AD B2C: OAUTH-KV does not work when sending email verification code #121237

Closed Rutakamekiar closed 6 months ago

Rutakamekiar commented 6 months ago

I use my API to send OTC emails. For my case I want to have custom query parameter. To do this, I add the appName request parameter during registration. But when I try to use {OAUTH-KV:appName}, I get {appName:null} in the request body. I also checked {Context:IPAddress} and it works Here is my implementation:

<ClaimsProvider>
      <DisplayName>RestfulProvider</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="SendOtp">
          <DisplayName>Send otp using API</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="ServiceUrl">https://xxx/api/SendEmailVerification</Item>
            <Item Key="AuthenticationType">None</Item>
            <Item Key="AllowInsecureAuthInProduction">true</Item>
            <Item Key="SendClaimsIn">Body</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="option" AlwaysUseDefaultValue="true" DefaultValue="{Context:IPAddress}" />
            <InputClaim ClaimTypeReferenceId="appName" AlwaysUseDefaultValue="true" DefaultValue="{OAUTH-KV:appName}" />
          </InputClaims>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>

API receives:

{
  "option": "10.10.10.10",
  "appName": null
}

Sign-up URL:

https://xxx.b2clogin.com/xxx.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/unified?local=signup&csrf_token=SWtpU0tTSGRTRDlWNDJtRjFJSjRFBVRk1OcitOZWNnK1J2eWt0L2dSTndBdkREeXF3MlpHZUVBSGZUQW91YXFQN2M3MXl1TzFGT2RSUzh3c28vYXc9PTsyMDI0LTA0LTAxVDE5OjE4OjAyLjUxMTA1NTNaOzRZend6NEU3eWZBV2hjZk85MjNrcnc9PTt7Ik9yY2hlc3RyYXRpb25TdGVwIjozfQ==&tx=StateProperties=eyJUSUQiOzkwNi0yMDgwLTRiNWMtOWQ4MS04OGIxOGE4NGM5NjkifQ&p=B2C_1A_signup_signin&appName=test123

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

PesalaPavan commented 6 months ago

@Rutakamekiar Thanks for your feedback! We will investigate and update as appropriate.

Naveenommi-MSFT commented 6 months ago

@Rutakamekiar I'd recommend working closer with our support team via an Azure support request. Or you can leverage our Q&A forum by posting your issue there so our community, and MVPs can further assist you in troubleshooting this issue or finding potential workarounds. Teams Q&A forum for technical questions about the configuration and administration of Microsoft Teams on Windows. Microsoft Teams Community forum

Rutakamekiar commented 6 months ago

Ok, thank you, I will create an Azure support request