Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GitHubStrategy example crashes app #55

Closed
juhanakristian opened this issue Nov 19, 2021 · 1 comment · Fixed by #60
Closed

GitHubStrategy example crashes app #55

juhanakristian opened this issue Nov 19, 2021 · 1 comment · Fixed by #60

Comments

@juhanakristian
Copy link
Contributor

The GitHubStrategy example in docs crashes the application with error Error: Promise rejected with value when clicking login.

image

Seems like the fix is to return the value of authenticator.authenticate in app/routes/auth/github.tsx

export let action: ActionFunction = ({ request }) => {
  return authenticator.authenticate("github", request);
};

Also the loader in app/routes/auth/github/calllback.tsx needs to be changed to return the value of authenticator.authenticate

export let loader: LoaderFunction = ({ request }) => {
  return authenticator.authenticate("github", request, {
    successRedirect: "/dashboard",
    failureRedirect: "/#",
  });
};

Tested with Remix 0.20.1.

I'd be happy to create a PR for this!

@sergiodxa
Copy link
Owner

Ahh you need to either return the value or await it making the loader/action an async function, if you want to send a PR to fix it I can merge it, if not I will send a PR in a few minutes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants