我正在尝试构建一个react应用程序,它将使用aws托管的ui进行身份验证。我正在尝试使用aws amplify来实现这一点,到目前为止,我还没有这样的运气。
Here
文档中指出,身份验证配置应该如下所示。
const oauth = {
domain : 'your-domain-prefix.auth.us-east-1.amazoncognito.com',
scope : ['phone', 'email', 'profile', 'openid','aws.cognito.signin.user.admin'],
redirectSignIn : 'http://www.example.com/signin/',
redirectSignOut : 'http://www.example.com/signout/',
responseType: 'code',
}
但是当我使用这个配置设置时,我得到了以下错误。
参数:应用程序客户端Id、应用程序web域、重定向URL
您已登录,注销时的重定向URL为
必需。
正如您所看到的,这些参数已明确提供。因此,我单击了控制台中链接有错误消息的源映射文件,并看到了这一点。
if (data == null || !ClientId || !AppWebDomain || !RedirectUriSignIn || !RedirectUriSignOut) {
throw new Error(this.getCognitoConstants().PARAMETERERROR);
}
这使得配置看起来更像是这样。
const auth = {
AppWebDomain: "aaaaa",
TokenScopesArray: ["phone", "email", "profile", "openid", "aws.cognito.signin.user.admin"],
RedirectUriSignIn: "http://localhost:3000",
RedirectUriSignOut: "http://localhost:3000",
responseType: "token",
ClientId: "aaa",
UserPoolId: "aaa",
};
但在执行此操作时,并尝试将用户发送到托管ui,如文档所述
here
我得到这个错误。
未捕获的TypeError:无法读取未定义的属性“domain”
我再次查看了源代码,发现了这个。
var domain = config.domain,
这使得它看起来像是在期待一个不起作用的配置。
在这一点上,我真的很迷茫,需要任何帮助。