0
falsharif created
ABP Framework version: v4.2.2 UI type: / Blazor DB provider: EF Core / Tiered (MVC) or Identity Server Separated (Angular): no
i am trying to create a UI inwhich when the user registers using his phone number, the backend autogenerates the password and should return a JWT token ( Same one we get when we authenticate using connect/token endpoint.
How can i authenticate and get a token in the backend programatically so ican send it as a response. ??
public virtual async Task<string> LoginOrRegister(LoginInputDto input) { await CheckSelfRegistrationAsync();
await IdentityOptions.SetAsync();
var user = new IdentityUser(GuidGenerator.Create(), input.PhoneNumber, input.PhoneNumber + "@dukkantek.com", CurrentTenant.Id);
user.SetPhoneNumber(user.UserName,true);
(await UserManager.CreateAsync(user, "#Pp" + input.PhoneNumber)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
var token = //code to login this new user and Generate token
return token;
}
1 Answer(s)
-
1
https://support.abp.io/QA/Questions/1222/Call-Api-Without-Dynamic-Proxy-Client-From-Blazor-Wasm--Http-Dynamic-Proxy-Error#answer-70a9566f-d304-2aba-52a4-39fc1df27abd