loading words...

Jan 30, 2019 23:35:40

Weirdest JavaScript bug

by @swizecteller | 200 words | 🐣 | 116💌

Swizec Teller

Current day streak: 0🐣
Total posts: 116💌
Total words: 32303 (129 pages 📄)

This is the weirdest JavaScript bug I have ever seen. It happens when talking to @auth0 from an AWS Lambda.

I need expert assistance. Questioning reality right now. #200wordsTIL


I have this method. getAuth0Token. It talks to Auth0 API to get something called a Management API Token.

It works.


getAuth0Token resolves with an object that holds my access_type and access_token. Console log proves this is true.


Next step is to ask Auth0's API for the user specific access token. It's an API call away using the previous access_token for authentication.

This is where shit gets weird.


getUserToken fails because both access_token and token_type are undefined.

Even though I'm passing them straight from the response object where I know they _are_ defined.


You can see the values are defined until suddenly they go into that function and are not defined anymore. I can't identify any typos. I have no idea what's wrong.



Okay so there's a bunch of code screenshots here and that totally counts for my words so I'm giong to write it out here an dle3t it all be. Yes something like that and I think it's great. Boom

Originally published at twitter.com

contact: email - twitter / Terms / Privacy