How do I get the CSRF token from the request body?
See original GitHub issueLooking at these lines: https://github.com/koajs/csrf/blob/master/src/index.js#L59-L60 when I’m debugging, ctx.request.body
is always undefined. I don’t know why. Can anyone help?
Something else: at the same breakpoint as above, ctx.csrf
IS defined. Should I just be using ctx.csrf
as the token? I’m confused as to why ctx.csrf
isn’t already treated as the token.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
CSRF tokens | Web Security Academy - PortSwigger
A CSRF token is a unique, secret, unpredictable value that is generated by the server-side application and transmitted to the client in such...
Read more >Is it a security risk to allow CSRF token to be sent in body OR ...
CSRF is about make a unsuspicious user post data to a server where the attacker believes the user is logged in.
Read more >Cross-Site Request Forgery Prevention Cheat Sheet
The CSRF token can be transmitted to the client as part of a response payload, such as a HTML or JSON response. It...
Read more >Integrating token-based Cross-Site Request Forgery (CSRF ...
The client acquires a new CSRF token from the server by calling the REST endpoint baseURL/v1/csrf/tokens. The server generates a new, unique CSRF...
Read more >Performing a POST request with a csrf token
The csrf token is obtained by first logging in to Assets Server through a POST request. The response that is received will include...
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 FreeTop 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
Top GitHub Comments
@joegalley super contrived example (will cleanup and add to the repo eventually):
I’ll throw an example together soon.