The automatic base64 encoding makes token cookie too large to save
See original GitHub issueDescribe the bug
Our Keycloak installation returns a token with length approximately around 3800 characters long. Technically that should be short enough to be stored as a cookie but it fails because when saving the SSRCookies
persistor base64 encodes the token which makes it around 5000 characters length.
To Reproduce Steps to reproduce the behavior:
- Use
<SSRKeycloakProvider />
with theSSRCookies
persistor. - Perform login and receive tokens token + idToken.
- If the token length is for instance 3800 characters long it will get base64 encoded into a 5000 character long string before being stored as a cookie. And Firefox will complain that the 5000 character kcToken cookie is too long to store.
Expected behavior
I expected the token cookie to be successfully set.
Desktop (please complete the following information):
- OS: macOS 11.2.3
- Browser Firefox
- Version 87
Additional context:
There might off course be good reasons as to why it is necessary to encode / decode these token strings. If that is the case, feel free to close this issue.
Many thanks for creating this solid library. 😄
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Cookies, Session, Token
Another issue: the data in the token is saved in plaintext (by using Base64 for encoding, but it is not encrypted. So, sensitive...
Read more >Base64 encoding and decoding in client-side Javascript
I used this method to encode a SVG in base64 with the Date URI scheme. Surprise: this function urlencodes every character, so I...
Read more >Cookie vs Token authentication
This article provides readers with a detailed guide on Token based authentication and Cookie based authentication and the advantages and ...
Read more >Cookies in Postman And How to Manage ...
Now go the Headers tab in the response section. Header_Response_2. Here you will find Set_Cookie which is the cookie being sent by the...
Read more >GraphQL file uploads - evaluating the 5 most common ...
Keep in mind that base64 encoded files are part of the enclosing JSON object. This means, you're not able to "stream" this base64...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aakay . We ended up building our own persistor that we pass into React Keycloak:
And then we use it like so:
Hope this helps! ✌️
@nilsnh hi nils, sorry, i’ve somehow missed your response. thanks for the help. this looks like a good solution. thank you.