Open Closed

Creating my own login page and attaching JWT token to authorization header #2664


User avatar
0
falsharif created
  • ABP Framework version: v5.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Dear support team, How do I authenticate and attach the JWT token to the authorization header without having to use the default Microsoft Identity Authentication page ?

The reason why I am asking this is because i am trying to create my own custom login page without having to customize the existing one and create a seamless login experience without having to redirect to Microsoft identity and then redirect back once logged in.

Best Regards, Fathi Alsharif


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you explain in more detail?

  • User Avatar
    0
    falsharif created

    Ok so i have the current test environment for my web app which cab be accessed on https://uat.promailnet.com/ when you land on https://uat.promailnet.com/ , the system will redirect the user to the auth server page on

    https://uatserver.promailnet.com/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DProMailNet_Blazor%26redirect_uri%3Dhttps%253A%252F%252Fuat.promailnet.com%252Fauthentication%252Flogin-callback%26response_type%3Dcode%26scope%3Dopenid%2520profile%2520ProMailNet%2520role%2520email%2520phone%26state%3De70063b5d57f46bfa630aa54a85e65af%26code_challenge%3DXddk2O1otOqY3v3KD8z5E1m1GneF1YEzopU-YitQZdM%26code_challenge_method%3DS256%26response_mode%3Dquery

    once the user logs in, it will redirect back to https://uat.promailnet.com/ with the user authenticated and the JTW token available in the header of every http request which is currently working fine.

    My issue is that customizing the Authorization page is hectic and limited, i also dont like the whole Single sign on Redirect mechanism .

    What i want is to be able to create my own login page from scratch as part of my blazor project and authenticate, get the token and attach it to my header without having to use the current authentication page of Microsoft Identity.

    For example when i create a mobile app, i use the https://uatserver/connect/token endpoint with grant type password and this generates a JWT token which is then used throughout the app on every Api request. I want to be able to do the same with my blazor application so i can avoid using the Microsoft identity login page created by the ABP framework.

    I hope this explains my scenario , I essentially want to create my own login page from scratch and have it in my blazor app instead of having it on my server application.

    Would really appreciate your answer and a solution that i can actually implement :)

    Cheers !

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This seems to have nothing to do with the abp framework, you can Google to find related solutions

  • User Avatar
    0
    falsharif created

    But in the Blazor app provided by the ABP framework, you have CurrentUser and CurrentTenant objects that can immediately be used to determine which user is logged in somehow using the token, how is that achieved ? and how come you are telling me that this has nothing to do with the ABP framework when its the abp framework that has all of this wired up ?

    Very poor answer for commercial support to be honest ! What do you mean just google it ?! I am not stupid, just needed some guidance but you are obviously not willing to guide me in the right direction.

    You should google to find out how to be better at supporting your clients.

    Anyway thanks for nothing

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I make an example that shows you how to get an access token to log in. see https://github.com/realLiangshiwei/Qa2664

    But the example is not perfect, just give you an idea.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35