如何解决使用OAuth 2验证码进行aws-amplify / auth
我有一个使用aws-amplify / auth(用户名,密码)来验证用户身份的应用程序。
const Auth = require("@aws-amplify/auth").default;
const Q = require("q");
const omit = require("lodash/omit");
const defaults = require("set-default-value");
class CognitoManager {
constructor(config) {
this.config = config;
Auth.configure({
userPoolId: config.cognito.userPoolData.UserPoolId,userPoolWebClientId: config.cognito.userPoolData.ClientId
});
}
async login(username,password) {
const user = await Auth.signIn({ username,password });
const hasChallenge = Boolean(user.challengeName);
const hasAccepted = hasChallenge ? user.challengeParam.userAttributes[ "custom:hasAccepted" ] : user.attributes[ "custom:hasAccepted" ];
return {
username: username,hasAccepted: hasAccepted === "1",challengeName: user.challengeName,groups: user.challengeName ? [] : await this.getGroups(user)
};
}
现在,客户端要使用Amazon Cognito托管UI进行注册和登录。现在的问题是,我没有获得用户名和密码,而是获得了验证码,然后可以从中获得(AccessToken,.. etc),因此是用户信息。
如何更改@ aws-amplify / auth以注册已签名的用户(无密码)以及拥有的身份(所以我可以调用Auth.currentAuthenticatedUser();)
这将有助于不更改其余代码。我已经搜索了,但没有任何答案。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。