Open Closed

Getting JWT Authentication Token In backend #1256


User avatar
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;
    }
    
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    1
    murat.yuceer created

    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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.