Getting AADSTS65001 error when using API

Yosi Kalmanson 0 Reputation points
2025-04-08T18:10:29.93+00:00

We are attempting to access the Microsoft Ads API using a refresh token obtained through the OAuth 2.0 authorization code flow. We have:

  1. Registered the application in Azure AD.
  2. Logged in using a work account with access to Microsoft Ads.
  3. Navigated to the authorize endpoint with prompt=consent and successfully received an authorization code.
  4. Exchanged the authorization code for an access token and refresh token (successfully).
  5. When attempting to use the refresh token in our Java app, we consistently receive the following error:

Couldn't request OAuth AccessTokens. Please use the getDetails() method to get more information. Details: invalid_grant - AADSTS65001: The user or administrator has not consented to use the application with ID '4aafbd96-d0bf-4f04-95f6-641e11b76cd7' named 'Visit App'. Send an interactive authorization request for this user and resource. Trace ID: a08bb0a5-f547-42f3-8a10-711bad4e1c00 Correlation ID: 45088ad3-28be-4d6e-9d21-32e1267dba7a Timestamp: 2025-04-08 18:05:34Z

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
464 questions
0 comments No comments
{count} votes

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.