Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    How to persist the JWT refresh token in httpOnly coockie?

    Front-End Development
    jwt vue laravel nodejs token
    2
    5
    485
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Harsha Sampath
      Harsha Sampath Web Development last edited by

      මගේ ප්‍රොජෙක්ට් එකේ frontend එක laravel+vuejs, Rest API එක nodeJs. මේ අතර authentication JWT වලින් තමා වෙන්නේ. මන් මේ JWT ගැන හොයල බැලුවම හැමොම කියල කියල තියෙනවා JWT token එක කවදාවත් frontend එකෙ store කරන්න එපා (localStorage/sessionStorage/IndexDB/coockie), simple XSS attack එකකින් පවා read කරන්න පුලුවන් කියල. හැම තැනම තියෙන්නේ රිස්ක් එක අඩුම ක්‍රමේ තමා JWT token එක memory එකේ තියාගෙන refresh token එක httpOnly coockie එකක තියාගන්න කියලා. මේ විදිහට login එකක් ලියලා token එක අරන් memory එකට දාලා home page එකට යැව්වුම httpOnly coockie එක header එකෙන් මැකෙනවා page එක refresh වෙන නිසා. කොහොමත් page refresh වෙද්දි memory එකේ තිබ්බ JWT token එකත් මැකෙන නිසා home page එකට යැව්වම මුකුත් නෑ user ගාව authenticate කරන්න. මෙන්න මේ URL එක refresh වෙද්දි httpOnly coockie එක මැකෙන එකට මොකක් හරි කරන්න පුලුවන්ද? token එක මැකුනත් කමක් නෑ refresh වෙලා page එකට අවාම httpOnly coockie එකේ තියෙන refresh token එක පාවිච්චි කරලා token එකක් ගන්න පුලුවන්නෙ එහෙම ඒක තියෙනව නම්.

      1 Reply Last reply Reply Quote 0
      • root
        root Linux Help last edited by

        machan cookie type http-only; secure da thiyenne ???

        Harsha Sampath 1 Reply Last reply Reply Quote 0
        • Harsha Sampath
          Harsha Sampath Web Development @root last edited by

          @root Secure enable කරන්න පුලුවන් https වලදී නේද. දැනට false තියෙන්නෙ.

          1 Reply Last reply Reply Quote 0
          • Harsha Sampath
            Harsha Sampath Web Development last edited by

            හොයාගත්තා අව්ල. මගේ httpOnly coockie එක එන්නේ NodeJs login API එක කතා කරද්දි නිසා coockie එක තියෙන්නෙ එන http response එකේ විතරයි. ඒක බ්‍රොව්සර් coockies වලට save වෙන්නේ නෑ. browser coockie වලට save වෙන්න නම් saverside render වෙන ගමන් coockie එක සෙට් වෙන්න ඕනේ. මේ ප්‍රොජෙක්ට් එකේ නම් මට direct nodejs app එකට login API එක කතා කරන්නේ නැතුව laravel එක හරහා curl වලින් කතා කරලා response එක දෙද්දි httpOnly coockie එක සෙට් කරන්න වෙනවා. නැත්තන් NuxtJs වගේ එකක් හරහා Server Side Render කරන්න වෙනවා .

            root 1 Reply Last reply Reply Quote 0
            • root
              root Linux Help @Harsha Sampath last edited by

              @Harsha-Sampath

              ahh okay.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              0
              Online

              3.6k
              Users

              1.3k
              Topics

              5.3k
              Posts

              • Privacy
              • Terms & Conditions
              • Donate

              © Copyrights and All right reserved Lanka Developers Community

              Powered by Axis Technologies (PVT) Ltd

              Made with in Sri Lanka

              | |