VScode keeps changing my functions?- Jamming Project: Invalid Client ID -

Hello everyone,
I ran into an Invalid Client ID trying to run my Jamming project. I was going through my code and comparing with others after reading and my problem is at getAccessToken(), my VScode keeps changing my window.setTimeout().

I should be


but
as soon as I click save,
it changes to

and I am not quite sure what to do about that?

I’ve worked with other online follow alongs so I assume maybe it is a setting I have but even with Prettier extension etc this fix just doesn’t seem to make sense?

Any help would be greatly appreciated. Thank you

The first thing I notice is that you use setTimeout as a property of window. You can use it as a standalone function. As a second try you could wrap the function body in curly braces. You don’t need the return value anyway:

setTimeout(() => { accessToken = '' }, expiresIn * 1000);

Does that help?
Why do you use a timeout for setting the access token?

Maybe you installed a linter extension in VSCode that does that?

Hi! Thank you for the response, I tried your suggestion but it did not change that I keep getting an Invalid Client Id. so perhaps it has nothing to do with this particular function?

so I am following along with the instructions and the getUnstuck video which has us do this


And the video says it the setTimeout is used on Window to make sure that we are not trying to access the token after it has expired and the window part is important since we are accessing this token via the current URL. (window.location.href)

I figured it out.

I had an extra backslash in my const redirectUri = “http://localhost:3000

(smashes forehead)

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.