Using API Azure AD Graph, always getting error Access Token missing or malformed
Hello,

My goal is to perform a search on the Azure Ad of an Office 365 using the authentication 'Service to Service Calls using client credentials' in Java

I get the access token successfully thanks to the API : https://login.windows.net/myDomain/oauth2/token?api-version=1.0

I try to perform a search on all the users of my AD, but I get an error 401 : {"odata.error":{"code":"Authentication_MissingOrMalformed","message":{"lang":"en","value":"Access Token missing or malformed."},"values":null}}

I put the access token in the header of my request, like I saw it on an example but it fails each time.
This is my code :

Client client = ClientBuilder.newClient();
WebTarget webTarget = client.target("https://graph.windows.net/myDomain/Users?api-version=1.0");
invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON_TYPE);
invocationBuilder.header("Authorization", "Bearer "+ token);
Response response = invocationBuilder.get();
System.out.println(response.getStatus());
System.out.println(response.readEntity(String.class));

Can you explain me what I am doing wrong ?

Thanks
September 15th, 2014 10:06am

Hello there, I'd love to help here.  It looks like your question is about Azure AD and not Azure SQL Database?  If so I'll get your question moved into the right forum.

Thanks Guy

Free Windows Admin Tool Kit Click here and download it now
September 23rd, 2014 1:24pm

Hello,

Yes indeed I put my message in the wrong category. I am talking about Azure AD.

I managed to find a solution to my problem: I have to use the API version 2013-11-08.

The API version 1.0 and 2013-11-08 are supposed to be identical but it does not work for me if I do not specify the version 2013.

September 24th, 2014 6:12am

Hello,

Yes indeed I put my message in the wrong category. I am talking about Azure AD.

I managed to find a solution to my problem: I have to use the API version 2013-11-08.

The API version 1.0 and 2013-11-08 are supposed to be identical but it does not work for me if I do not specify the version 2013.

  • Marked as answer by Marie Lcf 18 hours 35 minutes ago
Free Windows Admin Tool Kit Click here and download it now
September 24th, 2014 1:01pm

Hello,

Yes indeed I put my message in the wrong category. I am talking about Azure AD.

I managed to find a solution to my problem: I have to use the API version 2013-11-08.

The API version 1.0 and 2013-11-08 are supposed to be identical but it does not work for me if I do not specify the version 2013.

  • Marked as answer by Marie Lcf 18 hours 50 minutes ago
September 24th, 2014 1:01pm

Hello,

Yes indeed I put my message in the wrong category. I am talking about Azure AD.

I managed to find a solution to my problem: I have to use the API version 2013-11-08.

The API version 1.0 and 2013-11-08 are supposed to be identical but it does not work for me if I do not specify the version 2013.

  • Marked as answer by Marie Lcf Wednesday, September 24, 2014 3:55 PM
Free Windows Admin Tool Kit Click here and download it now
September 24th, 2014 1:01pm

Hello,

Yes indeed I put my message in the wrong category. I am talking about Azure AD.

I managed to find a solution to my problem: I have to use the API version 2013-11-08.

The API version 1.0 and 2013-11-08 are supposed to be identical but it does not work for me if I do not specify the version 2013.

  • Marked as answer by Marie Lcf Wednesday, September 24, 2014 3:55 PM
September 24th, 2014 1:01pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics