问题
I have created a .Net Application and to access certain outlook graph API's i need to fetch the access token and to get this access token i want authorization code which need to be passed. As far as the article for Authorization Code Flow, I have seen examples where we can get the authorization code by using the browser, whereas, in my case i want to retrieve the auth code within the application. Is there any way we can achieve this?
回答1:
How to get Authorization Code from Azure App using HTTP Request in C#?
In short, it's impossible.
The part of OAuth 2.0 authorization flow is as below:
When getting authorization code, user need to enter credential and consent permission which is an Interactive request. So, it's impossible to use C# code getting the code directly.
来源:https://stackoverflow.com/questions/59858751/how-to-get-authorization-code-from-azure-app-using-http-request-in-c