从文档中,请求授权码的方法非常难看:
// Line breaks for legibility only
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&response_mode=query
&scope=openid%20offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
&state=12345
&code_challenge=YTFjNjI1OWYzMzA3MTI4ZDY2Njg5M2RkNmVjNDE5YmEyZGRhOGYyM2IzNjdmZWFhMTQ1ODg3NDcxY2Nl
&code_challenge_method=S256
是否有针对此类请求的构建器类?尤其是考虑到要使用Azure时,我以为会有,但一直找不到。
该条款的第二段指出:
This article describes how to program directly against the protocol in your application using any language. When possible, we recommend you use the supported Microsoft Authentication Libraries (MSAL) instead to acquire tokens and call secured web APIs. Also take a look at the sample apps that use MSAL.
本文介绍了该协议的工作原理,但是几乎没有人会直接实现该协议。MSAL和许多其他库将为你包装此功能。
谢谢。您是否认为可以回答以下问题,因为我走了MSAL的道路却走得很短:stackoverflow.com/questions/65189280/…