相关疑难解决方法(0)

在 PKCE 的 OAuth 授权流程中使用时,如何在 Azure 应用注册中启用 CORS?

我有一个纯 Javascript 应用程序,它尝试使用带有 PKCE 的 OAuth 授权流程从 Azure 获取访问令牌。

该应用程序未托管在 Azure 中。我只使用 Azure 作为 OAuth 授权服务器。

    //Based on: https://developer.okta.com/blog/2019/05/01/is-the-oauth-implicit-flow-dead

    var config = {
        client_id: "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx",
        redirect_uri: "http://localhost:8080/",
        authorization_endpoint: "https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize",
        token_endpoint: "https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token",
        requested_scopes: "openid api://{tenant-id}/user_impersonation"
    };

    // PKCE HELPER FUNCTIONS

    // Generate a secure random string using the browser crypto functions
    function generateRandomString() {
        var array = new Uint32Array(28);
        window.crypto.getRandomValues(array);
        return Array.from(array, dec => ('0' + dec.toString(16)).substr(-2)).join('');
    }

    // Calculate the SHA256 hash of the input text. 
    // Returns a promise …
Run Code Online (Sandbox Code Playgroud)

javascript azure oauth-2.0 pkce

11
推荐指数
2
解决办法
7505
查看次数

Azure AD B2C 身份验证与 Azure AD 多租户

我已经按照这篇文章配置了 Azure AD 多租户身份验证:https ://docs.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-azure-ad-multi-tenant-custom ?标签=应用程序

身份验证在上周星期五有效,但现在突然失败。我尝试使用两端添加的新 App Id 和新 App 机密在 Azure AD 中重新注册该应用程序。

我得到的错误:

抱歉,我们在登录时遇到问题。AADSTS9002325:跨域授权代码兑换需要代码交换证明密钥。

我是否忽略了一些明显的东西?

身份验证与使用 React 和react-aad-msal的 SPA Web 应用程序一起使用

azure-active-directory azure-ad-b2c

8
推荐指数
1
解决办法
5295
查看次数