Client_id不允许给定的URL

时间:2014-12-11 10:24:32

标签: azure oauth

我已使用网络API 2实施了Google身份验证,并收到以下错误:

  

Client_id' ngAuthApp'不允许使用给定的网址配置。

当我将AllowedOrigin更改为(localhost)但在azure发布后无法在Client表中的api.mytouchstones-uat.net中工作时,此方法有效。

我的代码如下:

        // Enable the application to use bearer tokens to authenticate users
        app.UseOAuthBearerTokens(OAuthOptions);    
        //Configure Google External Login
        googleAuthOptions = new GoogleOAuth2AuthenticationOptions()
        {
            ClientId     = Common.Constant.GoogleClientId,
            ClientSecret = Common.Constant.GoogleClientSecret,
            Provider     = new GoogleAuthProvider()
        };
        app.UseGoogleAuthentication(googleAuthOptions); 

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,这是我的第一个谷歌搜索结果。所以我想如果其他人偶然发现这个问题,我可能会回答。

我猜你跟着this guide或类似的。

检查您发送到Facebook / Google等的redirect_uri是否与dbo.Clients中的AllowedOrigin相同。

并确保您的Facebook / Google appsettings中允许使用相同的uri。