【发布时间】:2019-11-04 09:34:26
【问题描述】:
我想在 Google 开发者控制台中为原生应用程序注册一个自定义 redirect_uri(如 pw.oauth2:/oauth2redirect)(这是 UWP 应用程序的推荐方法)。根据https://developers.google.com/identity/protocols/OAuth2InstalledApp#request-parameter-redirect_uri,必须有一个选择“自定义URI方案(Android,iOS,UWP)”的选项,但我只看到这些选项:
- 网络应用程序
- 安卓
- 铬
- iOS
- 其他
选择其他不允许我指定redirect_uri。
我应该如何为 UWP 应用注册自定义 redirect_uri?
如果我没有注册 redirect_uri,我会在 OAuth 授权过程中收到 redirect_uri_mismatch 错误。
此 github 示例中的 ClientID https://github.com/googlesamples/oauth-apps-for-windows/tree/master/OAuthUniversalApp 有效。看起来这个 ClientID 是 required_uri 注册的。但是如何为我自己的 ClientID 实现相同的目标?
这个老问题讨论了类似的问题,但也从未得到答复: Google APIs for UWP not playing nice with custom redirect scheme
编辑: 澄清。我正在使用上面提到的 Google 示例 (https://github.com/googlesamples/oauth-apps-for-windows/tree/master/OAuthUniversalApp)。它适用于 Google 提供的硬编码 ClientID。我无法让它与我自己的 ClientID 一起使用,因为我看不到在他们的开发者控制台中注册我自己的 redirect_uri 的方法。
【问题讨论】:
标签: uwp oauth-2.0 google-oauth