The received access token is not valid

Rustan Rodriguez 1 Reputation point
2022-08-24T06:32:43.903+00:00

When using the newly-created service principal, it throws this error:

azure.core.exceptions.ClientAuthenticationError: (InvalidAuthenticationToken) The received access token is not valid: at least one of the claims 'puid' or 'altsecid' or 'oid' should be present. If you are accessing as application please make sure service principal is properly created in the tenant.
Code: InvalidAuthenticationToken
Message: The received access token is not valid: at least one of the claims 'puid' or 'altsecid' or 'oid' should be present. If you are accessing as application please make sure service principal is properly created in the tenant.

I am sure that I am using the correct client_id, secret and tenant_id

Microsoft Security | Microsoft Entra | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JimmySalian-2011 42,491 Reputation points
    2022-08-24T11:21:22.227+00:00

    Hi,

    Thank you for asking this question on the Microsoft Q&A Platform.

    I am assuming and thinking on the lines of a missing OID usually means the servicePrincipal for your app does not exist in the tenant in which your trying to access.
    Each tenant in which you want to access must consent to your application. This will ensure the servicePrincipal exists in their tenant and that servicePrincipal has access to the Azure API.

    ==
    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.