小编Bri*_*kle的帖子

MS Identity Azure 应用程序已注册但在隐式流中发送未授权的客户端

我已在 Azure 中为 Microsoft Identity 平台注册了一个应用程序。我将其配置为允许 MS 帐户(例如 Outlook.com),并且基本上已经完成了此处此处的一些在线快速入门中的所有操作(“向您的 Web 应用程序添加凭据”除外)。我还选中了启用隐式流的框。

我将我的 React 应用程序重定向到要登录的 URL(使用隐式流程),我可以输入我的用户名,但随后我看到

未授权客户端:客户端不存在或未为消费者启用。如果您是应用程序开发人员,请通过https://go.microsoft.com/fwlink/?linkid=2083908 上的 Azure 门户中的应用程序注册配置新应用程序

就像我上面提到的那样,我已经经历了几个快速入门并在此处阅读了隐式流程并在我的代码中遵循了他们的示例。

我也尝试删除应用程序注册并重新开始。没运气。

尝试实现隐式流的 JS 代码

将浏览器重定向到一个 Url 的 JS 代码,该 URL 看起来像 Microsoft 在其隐式流程页面上的第一个示例

goSignIn() {
    const tenant = 'common'; // (for us with MS accounts)
    const clientId = '*****';
    const redir = encodeURIComponent('http://localhost:3000/signin');
    const nonce = Math.round(Math.random() * 10000, 0);
    const uriTemplate = 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?client_id={clientId}&response_type=id_token+token&redirect_uri={redirect}&scope=openid&response_mode=fragment&state={state}&nonce={nonce}';
    const filledTemplate = uriTemplate …
Run Code Online (Sandbox Code Playgroud)

azure azure-active-directory implicit-flow microsoft-identity-platform

5
推荐指数
2
解决办法
7740
查看次数