epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.88k stars 396 forks source link

Wrong constructor options on GitHubStrategy? #819

Closed WebCloud closed 1 month ago

WebCloud commented 3 months ago

Whist setting up my own app I've stumbled upon an error:

TypeError: Cannot read properties of undefined (reading 'toString')
    at GitHubStrategy.authenticate (file:///home/webcloud/code/perflab-frontend/node_modules/remix-auth-oauth2/src/index.ts:178:61)

Originating from https://github.com/epicweb-dev/epic-stack/blob/f1fd16da59a648e0755e1c6e5c136d05c7a78e48/app/utils/providers/github.server.ts#L31-L33

This seem to be refering to a missing constructor args: https://github.com/sergiodxa/remix-auth-oauth2/blob/main/src/index.ts#L178

AFter changin the callbackURL to redirectURI it threw a new error: cause: OAuth2Error: redirect_uri_mismatch

Which seemed to be related to the initially configured URL on the OAuth app. After changing and matching those I got a 404 since the clientId option is wrongly called clientID.

with those fixes I was able to finally get the GH OAuth login prompt, but got an error about a missing expires_in field.

kentcdodds commented 3 months ago

Hard to say since login works with the deployed version of the template: https://www.epicstack.dev

WebCloud commented 3 months ago

Interesting. I'll give it another shot and see. I thought I followed the doc properly but I might have missed on something then

Kampouse commented 2 months ago

add some similar issue while using pnpm but not on npm

pleroux0 commented 2 months ago

I also encountered the issue. It resulted from a breaking change of remix-auth-github between version 1.7.0 and 1.8.0. After switching back to 1.7.0, everything worked as expected.

WebCloud commented 1 month ago

Interesting comment by @Kampouse as I also used pnpm initially, but later converted back to npm. Maybe that is the common factor here. I''ll later also try testing moving it back to 1.7.0. I'm now focused on other stuff and won't be testing this anytime soon I'm affraid.

Maybe we can close this one and await to see if more ppl struggle with this @kentcdodds

kentcdodds commented 1 month ago

Yep 👍