Created
April 17, 2021 20:34
-
-
Save cursorial/4469d65434c2e621a886b42daad686e8 to your computer and use it in GitHub Desktop.
Get CSRF token on Instagram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getCookieObject = () => { | |
let obj = {} | |
document.cookie.split(';').map((item) => { | |
const keyValArray = item.split('=') | |
try { | |
const key = keyValArray[0].trim() | |
const val = keyValArray[1].trim() | |
obj[key] = val | |
} catch (e) {} | |
}) | |
return obj | |
} | |
const getCSRFToken = () => { | |
return getCookieObject()['csrftoken'] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment