office365api - OAuth token submitted with the request can not be parsed -


i'm trying implement client imports events user has in office 365 can display them in company's application.

i managed user authenticate / office 365 account , approve application , accesstoken, when try use token retrieve events api, 401 http error code, no body , in headers have this:

content-length →0 date →thu, 17 mar 2016 08:56:00 gmt server →microsoft-iis/8.0 www-authenticate →bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",basic realm="",basic realm="" x-beserver →db4pr06mb522 x-backendhttpstatus →401 x-calculatedbetarget →db4pr06mb522.eurprd06.prod.outlook.com x-diaginfo →db4pr06mb522 x-feserver →am3pr06ca022 x-powered-by →asp.net request-id →de1963bc-36df-4473-81f6-66ec37e8b415 x-ms-diagnostics →2000001;reason="oauth token submitted request can not parsed.";error_category="invalid_token" 

the token https://login.microsoftonline.com/common/oauth2/token following body:

grant_type=authorization_code redirect_uri=https://example.com/redirect-uri client_id=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx client_secret=[my-client-secret] code=[code-received-from-user-auth] 

the token receive above call, send through authorization header https://outlook.office.com/api/v2.0/me/events so:

authorization: bearer [access-token] 

the response status call 401 unauthorized, empty body , headers so:

content-length →0 date →thu, 17 mar 2016 08:56:00 gmt server →microsoft-iis/8.0 www-authenticate →bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",basic realm="",basic realm="" x-beserver →db4pr06mb522 x-backendhttpstatus →401 x-calculatedbetarget →db4pr06mb522.eurprd06.prod.outlook.com x-diaginfo →db4pr06mb522 x-feserver →am3pr06ca022 x-powered-by →asp.net request-id →de1963bc-36df-4473-81f6-66ec37e8b415 x-ms-diagnostics →2000001;reason="oauth token submitted request can not parsed.";error_category="invalid_token" 

can please tell me i'm doing wrong?

i managed fix problem had.

for future reference, problem wasn't telling https://login.microsoftonline.com/common/oauth2/token endpoint needed token for.

i had provide resource parameter base url of resource going interogate after. in case, https://outlook.office365.com.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -