Today I learned that in programming when you're stuck, you should copy the instructions. No, not follow the instructions, copypasta their code word for word.
Because copypasta will get you out of the weirdest shit imaginable. #200wordsTIL
So get this, I followed @auth0's instructions for adding authentication to your single page app. I was doing it with @gatsbyjs and that's just a small detail. The basics are the same:
1. Load auth0-js
2. Write an Auth object
3. Use the methods
4. Auth0 does the things
Yes I skimmed the guide, squinted, and said I got this. 💪
And I did 👉 click login, get Auth0's page, redirect back to your app
aaaand an error. Something something state
That's weird. I did everything the instructions said. Days of scratching my head, trying to figure out how it all went so wrong.
Carefully went through the tutorial word for word. Asked questions. Nothing helped.
Then I find the official Auth0 + Gatsby article with a sample repo.
But they did the same things I did. 🤨
Yet the official implementation worked and mine did not.
Ok screw this, I'm copypasting their Auth object.
Fuck me it worked. Copypasting the damn code worked. Still not sure what's materially different ...
Mine on left, @mroliff's on right. His works mine doesn't. 🤨