Azure-Samples / active-directory-verifiable-credentials

A code sample demonstrating how to use Azure Active Directory's preview functionality to issue and consume verifiable credentials.
107 stars 65 forks source link

B2C VC Example Display and Rules manifest not working #57

Closed jasonfritts closed 2 years ago

jasonfritts commented 2 years ago

When trying to create a new credential in the Verified ID -> Create credential -> Custom Credential UI the example display and rules files for B2C on this sample (https://github.com/Azure-Samples/active-directory-verifiable-credentials/tree/main/B2C) do not seem to be valid any longer.

Example Display Definition:

{
    "default": {
      "locale": "en-US",
      "card": {
        "title": "Verified B2C Expert 2",
        "issuedBy": "MyOrgName",
        "backgroundColor": "#B8CEC1",
        "textColor": "#ffffff",
        "logo": {
          "uri": "https://mystorage.blob.core.windows.net/images/VerifiedCredentialExpert_icon.png",
          "description": "Logo"
        },
        "description": "Use your verified credential card to prove you are a B2C user."
      },
      "consent": {
        "title": "Do you want to get your B2C VC card?",
        "instructions": "Sign in with your account to get your card."
      },
      "claims": {
        "vc.credentialSubject.firstName": {
          "type": "String",
          "label": "First name"
        },
        "vc.credentialSubject.lastName": {
          "type": "String",
          "label": "Last name"
        },
        "vc.credentialSubject.oid": {
          "type": "String",
          "label": "oid"
        },
        "vc.credentialSubject.tid": {
          "type": "String",
          "label": "tid"
        },
        "vc.credentialSubject.displayName": {
          "type": "String",
          "label": "displayName"
        },
        "vc.credentialSubject.username": {
          "type": "String",
          "label": "username"
        }
      }
    }
  }

Example Rules file definition:

{
  "vc": {
    "type": [ "Verified B2C Expert 2" ]
  },
  "validityInterval": 2592000,
  "attestations": {
    "idTokens": [
      {
        "mapping": {
          "displayName": { "claim": "name" },
          "oid": { "claim": "oid" },
          "tid": { "claim": "tid" },
          "username": { "claim": "email" },
          "lastName": { "claim": "family_name" },
          "firstName": { "claim": "given_name" }
        },
        "configuration": "https://myb2ctenant.b2clogin.com/myb2ctenant.onmicrosoft.com/B2C_1A_SIGNUP_SIGNIN_VC/v2.0/.well-known/openid-configuration",
        "client_id": "5754c86a-e195-459e-98cf-2546ef5eb0c8",
        "scope": "openid",
        "redirect_uri": "vcclient://openid"
      }
    ]
  }
}

When trying to upload these definitions in portal the following error is returned:

{"requestId":"ea4d17be61b492d221414d73bc7be783","date":"Sat, 06 Aug 2022 15:41:55 GMT","mscv":"QlYd3WAkkDu4Br0l.2","error":{"code":"missingRequiredParameter","message":"clientId is a required value. Please enter a value and try again."}}

Can we update the example display and rules file definition for the B2C VC Sample?

cljung commented 2 years ago

@jasonfritts - JSON rules n display definitions are now updated to match the the formats you paste in the portal UX when you create custom credentials. https://github.com/Azure-Samples/active-directory-verifiable-credentials-dotnet/tree/main/3-asp-net-core-api-b2c/credentials