HttpListenerException-Google OAuth2-拒绝访问 [英] HttpListenerException - Google OAuth2 - Access is Denied

查看:92
本文介绍了HttpListenerException-Google OAuth2-拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

When I run my website locally it works fine and opens a new tab for google authentication before accessing the Google Sheets API.  However, after deployment on Azure Web Apps, I'm getting an HttpListenerException.  If you'd like to view the full InnerException stack trace, visit bryterops.com.

我相信这是Azure上的权限问题,因为我以前在GoDaddy上遇到过此问题,而我只是将IIS的完全权限授予了wwwroot文件夹.但是,到目前为止,我还无法在Azure上执行此操作.  任何帮助都是极大的 赞赏.  下面是我的C#代码,错误发生在GoogleWebAuthorizationBroker上.

I believe that this is a permissions/rights problem on Azure as I had this problem previously on GoDaddy and I just gave IIS full permissions to the wwwroot folder.  However, I have not been able thus far to do this on Azure.  Any help is greatly appreciated.  Below is my C# code, the error is on GoogleWebAuthorizationBroker.

您可以再次检查credPath在网站上返回的内容.

You can double check what the credPath is returning on the site.

public List<Technician> GetTechnicians(string credPath)
{
     UserCredential credential;
     ClientSecrets secrets = new ClientSecrets()
     {
          ClientId = "1050899790942-50r9h0bofm7nkugv7j4p8od8jpsttois.apps.googleusercontent.com",
          ClientSecret = "70gnly6rSSfkmEb0OX0Me6cx"
     };

     string step = "step1Technicians";
     try
     {
          step = "step2Technicians";

          credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                        secrets,
                        Scopes,
                        "user",
                        CancellationToken.None,
                        new FileDataStore(credPath, true)).Result;

          step = "step3Technicians";

          Console.WriteLine("Credential file saved to: " + credPath);
     }
     catch (Exception ex)
     {
          throw new Exception("Step: " + step + "\ncredPath: " + credPath + "\nMessage: " + ex.Message + "\nInner Exception: " + ex.InnerException);
     }



Thank you!

推荐答案


感谢您与Microsoft论坛联系.我们很高兴为您解答.


Thank you for contacting Microsoft forums. We are pleased to answer your query.

我们正在检查查询并会尽快就此与您联系.

对于由此给您带来的不便和抱歉,我们深表歉意感谢您在此问题上的时间和耐心.

I apologise for the inconvenience and appreciate your time and patience in this matter.


Regards.


这篇关于HttpListenerException-Google OAuth2-拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆