Base solution for your next web application
Open Closed

How to add alternative auth token way #8384


User avatar
0
peopleteq created

I need to modify current api/TokenAuth/Authenticate method. This method uses userNameAndMail and password fields for authentification. I am looking for a way to add a couple of fields to the AbpUser and use them in certain way I need. Is that possible?

Thanks


7 Answer(s)
  • User Avatar
    0
    peopleteq created

    Hi there!:)

  • User Avatar
    0
    peopleteq created

    Just to clarify... I need to add a couple of fields which will be used in authentification instead of original user/password pair

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @peopleteq

    Sorry for our late reply. You can add new fields to User as explained here.

    Then, you can use those fields in TokenAuthController. If you can share your use case, I will try to help you further.

  • User Avatar
    0
    peopleteq created

    Hi @ismcagdas

    Thank you for reply. I figured out how to add more attributes into User. I am going to add 2 attributes CardId and SecretKey. These attributes are required for the same way asn UserName and Password. I need to modificate auth services in the way to use new fields if token auth dto has attribute IsByCard (added also by me) equal true. I other words I want make login service to use my attributes when that is required. Could you gelp please?

  • User Avatar
    0
    peopleteq created

    Hi there:)

  • User Avatar
    1
    BobIngham created

    @peopleteq, my approach was to copy the Zero AppTokenAuthController and place it in the Web.Core project under a different namespace. I then have the standard sign in for the Zero system and a different sign in route for my Ionic apps, that way I can control device registration: Just be careful to keep an eye on github for changes to the standard Zero AppTokenAuthController so you can implement any changes in your own AppTokenAuthController. This route has worked for me to date and I've been running a trial production system for over a year.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks a lot @bobingham :)