kiliman / tailwindui-crawler

tailwindui-crawler downloads the component HTML files locally
MIT License
773 stars 99 forks source link

not logged in error #84

Closed muesli-dev closed 8 months ago

muesli-dev commented 8 months ago

I can't download the Tailwind CSS with my credentials. I bought the single dev license and can't download it with this crawler, after the first fetch (login) it says login success after that the next fetch says "not logged in"

muesli-dev commented 8 months ago

i found a "simple" fix for the problem.

Replace the parseSetCookieHeaders Function with the following (index.mjs:161):

function parseSetCookieHeaders(header) { let cookies = {} const [cookie] = header.split(';') const [name, value] = cookie.split('=') cookies[name] = decodeURIComponent(value) return cookies }

Then open your chrome, log in to tailwind ui, open your console (F12), go to network and reload the website. The first request should contain a cookie with your authentication. Copy all cookie data/text.

image

Put your cookie into this let like that with "" (index.mjs:74):

image

Last step is to remove the code that overwrites your set cookie with the first login request. Remove or comment out the code. (index.mjs:100-104) image

tad-da! the login is now taken care of by your "stolen" token, and you can fetch the tailwind css.

image

kiliman commented 8 months ago

Hmm... I'll take a look at the code that is setting headers. I'm wondering if the spread syntax is not working correctly in some cases.

sujeetpillai commented 8 months ago

@muesli-dev Thanks for this. I'll test this out on my side