I'm trying to connect to the Entra Verifiable Credentials Admin API based on the documentation found here: https://learn.microsoft.com/en-us/azure/active-directory/verifiable-credentials/admin-api, however I can't seem to issue client credentials that are able to call the Admin API endpoints.
I'm creating an access token like so:
GET https://login.microsoftonline.com/<tenant_id>/oauth2/token?<query_params>
Query Params:
client_id=<client_id>
client_secret=<client_secret>
scope=6a8b4b39-c021-437c-b060-5a14a3fd65f3/full_access
grant_type=client_credentials
The scope in the above call was found here: https://learn.microsoft.com/en-us/azure/active-directory/verifiable-credentials/admin-api Calling the endpoint https://verifiedid.did.msidentity.com/v1.0/verifiableCredentials/authorities with the token returned from above returns the response:
"error": {
"code": "token_validation.audience_invalid",
"message": "The token does not contain the expected audience '0135fd85-3010-4e73-a038-12560d2b58a9,6a8b4b39-c021-437c-b060-5a14a3fd65f3'."
}
I also tried creating an access token using the MSAL library in .NET like this:
var app = ConfidentialClientApplicationBuilder.Create("<client_id>")
.WithClientSecret("<client_secret>")
.WithAuthority(new Uri("https://login.microsoftonline.com/<tenant_id>"))
.Build();
var result = await app.AcquireTokenForClient(new string[] { "6a8b4b39-c021-437c-b060-5a14a3fd65f3/.default"}).ExecuteAsync();
Console.WriteLine("Access Token: {0}", result.AccessToken);
The MSAL library throws an error if the scope doesn't end with /.default
, so I switched what the Verifiable Credentials Admin API suggests to 6a8b4b39-c021-437c-b060-5a14a3fd65f3/.default
. Using the credentials output by the MSAL library to call the Admin API returns this error:
"error": {
"code": "Unauthorized",
"message": "Provided access token contains no wids.",
"innererror": {
"code": "token_validation.invalid_aad_access_token",
"message": "Provided access token contains no wids."
}
}
The Application Registration has the Verifiable Credentials Service Admin.full_access
permission assigned and has been granted admin consent. I'm not sure what I'm doing wrong or what I need to change to get an access token that's able to call the Verifiable Credentials Admin API.