Unable to find proper value for scope-parameter in OAuth2 request

Prakhar Gupta 1 Reputation point
2022-01-31T07:54:37.877+00:00

We've an azure application that we use to read Mail, Calendar, and Contact data using Microsoft 365 API.
We're setting up OAuth2 bases authorization for this application using the instructions mentioned at this URL.

We're using auth_code based flow. While sending the request to fetch access_token and refresh_token, we're getting the below error ""

Caused by: xyz.ServiceException: HTTP/1.1 401 Unauthorized[Server: Microsoft-IIS/10.0, request-id: 1f621fb9-9843-e816-6b92-7cf38d598702, Alt-Svc: h3=":443",h3-29=":443", X-CalculatedFETarget: MWHPR18CU003.internal.outlook.com, X-BackEndHttpStatus: 401, Set-Cookie: exchangecookie=6c1b79f2eb0d469f842fb8520b27f4c4; path=/; secure, X-FEProxyInfo: MWHPR18CA0068.NAMPRD18.PROD.OUTLOOK.COM, X-CalculatedBETarget: MWHPR22MB0047.NAMPRD22.PROD.OUTLOOK.COM, X-BackEndHttpStatus: 401, X-RUM-Validated: 1, x-ms-diagnostics: 2000008;reason="The token contains no permissions, or permissions can not be understood.";error_category="invalid_grant", X-BeSku: Gen9, X-DiagInfo: MWHPR22MB0047, X-BEServer: MWHPR22MB0047, X-Proxy-RoutingCorrectness: 1, X-Proxy-BackendServerStatus: 401, X-FEServer: MWHPR18CA0068, X-FirstHopCafeEFZ: MNZ, X-Powered-By: ASP.NET, X-FEServer: MN2PR17CA0025, WWW-Authenticate: Bearer client_id="~~~~~~~", trusted_issuers="~~~~~~~", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",Basic Realm="", Date: Mon, 31 Jan 2022 07:18:28 GMT, Content-Length: 0]

This was after we used 'scope' as
openid offline_access https://outlook.office.com/.default

We get the following consent dialogue box while signing in
169842-image.png

Could you please tell why we're getting the above error?

Microsoft 365 and Office Development Microsoft 365 Publishing
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.