React - AWS Amplify Facebook 登录 - "Username Attribute Mapping Required"
React - AWS Amplify Facebook Login - "Username Attribute Mapping Required"
我已经安装了 AWS Amplify CLI 并通过 Facebook 添加了联合身份验证。在 Cognito 中,属性被适当地映射。
当使用 AWS Amplify (aws-amplify) React 库时,使用 Auth 组件,我为用户提供了一个登录按钮,它调用 Auth.federatedSignIn({provider: 'Facebook'} ).调用成功转到 Facebook 并成功重定向回我的应用程序。
但是,我收到一条错误消息,显示 "username attribute mapping required." 但是当我转到 Cognito 时,我已将用户名映射到 ID。关于为什么我会收到此错误的想法?
TLDR: 在您应用的 Facebook 开发者门户设置中关闭 "Require App Secret"。
直到我尝试以更直接的方式(即在 Amplify 之外)使用 Facebook 的登录,我才能够查明更有价值的错误代码。我终于收到了导致我 here.
的错误 "API calls from the server require an appsecret_proof argument,"
Facebook 团队回应:
This issue was caused by a backend change that has made appsecret_proof incompatible with the JavaScript API. After evaluating the change, it has been decided that this behavior will have to remain. As such, for your apps that use the JavaScript API, you will now need to uncheck "Require App Secret." You may then want to set up a separate app for your server side logic so that appsecret_proof can be used for increased security.
关闭后 "Require App Secret," 我就设置好了。如果您的应用程序的安全级别对您来说无关紧要,那么这是唯一的答案,除非 Amplify 提供了一些服务器端版本。
我已经安装了 AWS Amplify CLI 并通过 Facebook 添加了联合身份验证。在 Cognito 中,属性被适当地映射。
当使用 AWS Amplify (aws-amplify) React 库时,使用 Auth 组件,我为用户提供了一个登录按钮,它调用 Auth.federatedSignIn({provider: 'Facebook'} ).调用成功转到 Facebook 并成功重定向回我的应用程序。
但是,我收到一条错误消息,显示 "username attribute mapping required." 但是当我转到 Cognito 时,我已将用户名映射到 ID。关于为什么我会收到此错误的想法?
TLDR: 在您应用的 Facebook 开发者门户设置中关闭 "Require App Secret"。
直到我尝试以更直接的方式(即在 Amplify 之外)使用 Facebook 的登录,我才能够查明更有价值的错误代码。我终于收到了导致我 here.
的错误 "API calls from the server require an appsecret_proof argument,"Facebook 团队回应:
This issue was caused by a backend change that has made appsecret_proof incompatible with the JavaScript API. After evaluating the change, it has been decided that this behavior will have to remain. As such, for your apps that use the JavaScript API, you will now need to uncheck "Require App Secret." You may then want to set up a separate app for your server side logic so that appsecret_proof can be used for increased security.
关闭后 "Require App Secret," 我就设置好了。如果您的应用程序的安全级别对您来说无关紧要,那么这是唯一的答案,除非 Amplify 提供了一些服务器端版本。