Token Based Authentication vs Sessions

NEMISIS

Well-known member
  • Nov 13, 2013
    11,422
    19,606
    113
    Colombo
    Depends.
    If you are working with REST APIs/SPAs, practice is to use token based authentication. You can use JWT or opaque or any other the token type, you MUST carefully implement token issuing/refreshing/revoking/exploration process.

    For apps like traditional web apps you can use sessions. (there is no restriction to use token based az for these apps as well)

    If you really need, you can implement both of them as well, i have seen such implementations on some of the popular software products.

    In summary
    It Depends
    There is no hard and fast rule, you can implement whatever the method that suites your requirements/expertise.
    These are most exploited features in software systems so need to implement these properly and carefully, and needs to do proper security reviews.

    You can use already existing Identity management and API management solutions as well.
     

    Psiko

    Well-known member
  • Mar 10, 2023
    14,037
    13,970
    113
    🤍
    Ehenan session lesi ne

    @Psiko මොකෝ හිනා උනේ ඒක අවුල්ද 😬
    ------ Post added on Jan 10, 2024 at 3:55 PM
    ahh man hithuwe yata ekata kuiwa kiyla ekai ... my bad.


    token damma

    logout ekedi witharak error ekak enawa backend eken user notauthenticated kiyala network request eke preview eke.:confused: