问题
I'm trying to use the new office365 unified api to query the users list and user file. I've created the application in azure management portal, and I gave the permission to the new api application (with the directory and files read) I've created both a client and a webapi application, to try.
In my code, I use a x509 certificate to acquire the token, and I get it without problem. Then I call, with curl, the url "https://graph.microsoft.com/beta//users/" to get the users list, and I get a 500 error: Object reference not set to an instance of an object. I've tried with other urls, and also I've tried call that url, with the same header (the authorization: bearer, etc) directly in firefox, and I've the same problem.
I've checked if it's an authorization error, but it doesn't seam... If I omit the authorization header, or I but a wrong one, I get a 401 error. Here's the header I'm sending to the url: User-Agent: php-microsoft-graph-api/1.0 Authorization: Bearer ey... Accept: application/json client-request-id: cbe6f962-8b7e-ee4d-a1bc-34c260cf93ec return-client-request-id: true
I've tried the url with the graphexplorer2 app, and it work ok... Any hint or suggestion to debug the problem? Thanks to all
EDIT: I've forgot to say that I'm using the client credential flow (because I'm developing a daemon) and I've notice that the access token that I get, is shorter than a token with the normal authentication flow... So, a new question: is the new office 365 api compatbile with client credential flow? There's any method I could use to "authenticate" my app, without passing thought a browser?
回答1:
Client credential flow is not yet supported in the Office 365 unified API preview. It is on the roadmap. In the meantime you can use app + user flows.
来源:https://stackoverflow.com/questions/30862712/office-365-unified-api-object-reference-not-set-to-an-instance-of-an-object