【问题标题】:Migration of Google Apps Marketplace app to oAuth 2.0 with additional scopes将 Google Apps Marketplace 应用迁移到具有附加范围的 oAuth 2.0
【发布时间】:2014-04-18 07:26:44
【问题描述】:

我们在旧市场中有使用 oauth 1.0 的应用。我们正在迁移到新市场的 oauth 2.0。我们正在使用 UpgradeableApp API 对现有域进行迁移。我正在执行此处指定的步骤:https://developers.google.com/apps-marketplace/v1migratev2

如上述链接中的先决条件所述:新旧应用的范围必须兼容。但是我们的新应用程序有一些额外的范围。有没有办法在迁移时授予对这些额外范围的访问权限。

【问题讨论】:

    标签: google-apps-marketplace


    【解决方案1】:

    只有域的管理员或用户可以批准其他范围。

    域的管理员在升级后会收到一封电子邮件通知。

    在您的 oauth2.0 应用程序中,您可以检测是否所有范围都已获得批准。如果没有,您可以向用户显示适当的消息以联系域管理员以批准范围。

    【讨论】:

      【解决方案2】:

      为此,我们应该在旧列表和新列表中具有相同的范围。我也面临着将旧用户迁移到新用户的同样问题。请检查下面的代码我是如何从旧用户迁移到新用户的,但是每次我得到 401 UnAuthorized,我可以知道我缺少什么。

      String url = String.Format("https://www.googleapis.com/appsmarket/v2/upgradableApp/{0}/{1}/{2}", oldAppId, chromeListing, domain);            
              HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
              request.Method = "PUT";
              request.ContentType = "application/json";
              request.Accept = "application/json";
              request.ProtocolVersion = HttpVersion.Version11;
              request.Credentials = CredentialCache.DefaultCredentials;
              request.Headers.Add("Authorization", "OAuth");
              Hashtable postObj = new Hashtable();
              postObj["Consumer Key"] = oldClientId;
              postObj["Consumer Key Secret"] = oldSecret;
              String s1 = new JavaScriptSerializer().Serialize(postObj);
              var bs = Encoding.UTF8.GetBytes(s1);
              using (Stream reqStream = request.GetRequestStream())
              {
                  reqStream.Write(bs, 0, bs.Length);
              }
              using (WebResponse response = request.GetResponse())
              {
                  using (var sr = new StreamReader(response.GetResponseStream()))
                  {
                      result = sr.ReadToEnd();
                      sr.Close();
                  }
              }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-16
        • 1970-01-01
        • 2016-02-17
        • 2013-02-28
        相关资源
        最近更新 更多