【发布时间】:2021-02-28 05:47:39
【问题描述】:
我正在尝试更新现有的 React Amplify 应用程序,该应用程序使用 AWS Cognito 用户池进行身份验证,以也使用通过 SAML 集成的 Okta SSO 进行身份验证。 Cognito 是根据these instructions 配置的,我很确定一切都配置正确,因为当我使用 Cognito 控制台中的“启动托管 UI”按钮时,我会看到带有 Okta 和 Cognito 用户名/密码面板的正确登录对话框并且可以使用其中任何一个进行身份验证。
虽然在 React 中使用 Authenticator 组件调用时,我无法显示相同的面板,我认为这是因为我没有正确设置 federated 参数,但我能找到的唯一文档是用于配置 Google、Facebook 或 Auth0,而不是 Okta。
我得到的错误是:
Unhandled Rejection (TypeError): Cannot read property 'oauthSignIn' of undefined
并且代码设置如下(但我尝试了许多排列但没有运气):
const federatedInfo = {
oauth_config: {
domain: 'xxx.auth.us-east-1.amazoncognito.com',
clientID: 'zzz',
redirectUri: 'http://localhost:3000/',
audience: 'urn:amazon:cognito:sp:us-east-yyy',
responseType: 'token', //'token id_token', // for now we only support implicit grant flow
scope: 'openid email',
returnTo: 'http://localhost:3000/'
}
};
<Authenticator
{...props}
theme={AmplifyTheme}
federated={federatedInfo}
hideDefault={true}
signUpConfig={authConfig.signUpConfig}
onStateChange={(state, data) => {
setAuthData({authState: state, user: data});
}}
children={[<Greetings/>, <SignIn federated={federatedInfo}/>, <ConfirmSignIn/>, <VerifyContact/>, <ForgotPassword/>, <RequireNewPassword/>]}
/>;
关于如何让它工作的任何提示?
【问题讨论】:
标签: single-sign-on amazon-cognito saml aws-amplify okta