我正在尝试在同一呼叫中添加更多用户信息。首先在 Auth0 中使用用户名、密码进行注册,然后在回调中继续将用户信息添加到我的数据库中。但我无法让它工作。即使用户已经存在于 Auth0-db 中,它也会触发 API。
这是 AuthService 中的代码:
public signup(signupForm, callback) {
const self = AuthService._instance;
var result = "";
self._angularAuth0.signup({
connection: "Users",
responseType: "token",
email: signupForm.email,
password: signupForm.password
}, (error) => {
console.log(error);
}, this.onSignupSuccess(signupForm));
}
private onSignupSuccess(form) {
const self = AuthService._instance;
const newUser = {
firstName: form.firstName,
lastName: form.lastName,
email: form.email,
birthdate: new Date(form.birthYear, form.birthMonth, form.birthDay),
auth0_UserId: this.userProfile.user_id,
gender: form.gender
};
self._dataService.add(this.baseUrl + "/users/", newUser);
}
app.ts 内部:
angularAuth0Provider.init({
clientID: "3LGkdfVvFfdsdfMpz1UVcwjh1jktrf7j",
domain: "somedomain.eu.auth0.com",
callbackURL: "http://127.0.0.1:8080/authorized",
});