Skip to content

How to support 2 login methods: email and github OAuth at once? #4836

Answered by aliemir
liushooter asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @liushooter, you can easily support multiple auth methods with refine. By looking at your code, I can see couple of misunderstandings, let me try to help you fix them 🚀

The methods in the authProvider are called by <Refine> but React hooks cannot be used inside them. You can just do the fetch call instead of using it inside useEffect. Same thing also applies for useNavigate and useLocation hooks, instead of using these hooks, you can use the window.location, you can use location.open or location.href for navigation and location.search for getting the URL params.

You may also need to use await instead of then for the api request. 🚀

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aliemir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants