I’ve been struggling to successfully get data from microsoft graph, to be more precise, struggling to get valid authentication token. I followed all instructions and code samples from their github but I cannot get it to work. In image below is my code.
Important fact is that when I hardcode token, which I got from Graph Explorer, it works perfectly…
When I try to get data with token obtained with AuthProvider, I get exception Request_ResourceNotFound.
App is registered, access is granted (that’s why it works with hardcoded token).
NuGet references imported are Microsoft.Graph, Microsoft.Graph.Client, Microsoft.Identity.Client (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet)
If someone can help me with this problem or suggest anything, I would be grateful.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Problem was that I was requesting “Me” endpoint, while authenticating as application (not user). Exception message was not clear enough to understand that at first…
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0
