Warm tip: This article is reproduced from serverfault.com, please click

azure-是否有用于Microsoft身份平台和OAuth 2.0授权的OAuth 2构建器?

(azure - Is there an OAuth 2 builder for Microsoft identity platform and OAuth 2.0 authorization?)

发布于 2020-12-08 20:59:13

文档中,请求授权码的方法非常难看:

// 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时,我以为会有,但一直找不到。

Questioner
8protons
Viewed
0
Derek Gusoff 2020-12-09 05:16:20

该条款的第二段指出:

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和许多其他库将为你包装此功能。