问题标签 [aswebauthenticationsession]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
76 浏览

ios - 如何获取 ASWebAuthenticationSession 的控制台日志

我使用 safari 调试 ASWebAuthenticationSession,它会给出 401 错误。但我想将此日志信息打印到应用程序中。

0 投票
0 回答
19 浏览

swift - 本地 Mac 应用程序 redirect_uri 的 Google OAuth 2 请求 invalid_request

我正在ASWebAuthenticationSession尝试在原生 Mac 应用程序中使用 Google 的 OAuth 2.0 API 进行身份验证。我在 Google Developer Console 中将我的应用程序注册为这样的Desktop类型应用程序:

在此处输入图像描述

我这样构建我的 URL:

然后我发起这样的请求:

由于与redirect_uri.

在此处输入图像描述

我一辈子都看不到我做错了什么。Google 似乎不想让我使用自定义 URI。我是否必须将应用程序类型更改为其他类型?Desktop不适用于 Mac 应用程序?

0 投票
1 回答
34 浏览

oauth-2.0 - 桌面 Mac 应用程序中的 Google OAuth - 错误 400:redirect_uri_mismatch

我正在尝试通过本机 Mac 应用程序向 Google OAuth 2 进行身份验证。我在 Google Developer Console 中将我的应用程序设置为Desktop应用程序,但无处指定redirect_uri. 据我了解,这些仅适用于 Web 应用程序。

但是在使用 Swift 编写我的请求时ASWebAuthenticationSession,我得到的身份验证 URL 是这样的(为易读添加了换行符):

我的应用的自定义 URL 类型是pro.cova:/.

我从 Google 收到此错误:

如果 Google Developer Console 中没有指定不匹配,可能会发生什么不匹配?