4

我们正在为 Web 应用程序实现 Sign In with Apple 功能。我们遵循基于 ReST 的方法。授权调用工作正常,我们正在返回请求对象上获取“代码”和“状态”值。但我没有得到客户信息。

授权端点:https ://appleid.apple.com/auth/authorize

苹果文档中完全缺少用户信息部分。有谁知道要访问哪个端点来获取用户信息以及请求格式是什么。

我已经尝试了来自 Apple 的令牌 API 调用,我得到的响应是 'unsupported_grant_type'

端点:appleid.apple.com/auth/token

标题:svc.addHeader("Content-Type", "application/x-www-form-urlencoded");

身体 :

{'client_id' : client_id, 'client_secret_key' : client_secret_key,
'grant_type' : grant_type, 'code' : code, 'redirect_uri' : redirect_uri}

我们设置为“authorization_code”的 grand_type 值。

响应服务=AppleSignInTokenService 状态=ERROR errorCode=400 errorMessage={"error":"unsupported_grant_type"}

请让我知道我哪里出错了。

4

1 回答 1

1

如果您收到 400 错误,请检查重定向 URL 是否存在于服务 ID 重定向部分。确保客户端 ID 是否与服务 ID 标识符相同。

如果您获得 200,但没有用户信息返回。那可能是你已经用你的网站用苹果登录了,你可以去https://appleid.apple.com/account/manage,然后在安全下点击使用APPLE ID的APPS & WEBSITES。如果您看到您的网站,请单击停止使用 Apple ID。现在,当您返回站点再次登录时,用户信息将被包含在内。似乎苹果只在第一次返回用户信息。

于 2019-12-14T06:22:45.110 回答