How to support 2 login methods: email and github OAuth at once? #4836
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 You may also need to use |
Beta Was this translation helpful? Give feedback.
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 thefetch
call instead of using it insideuseEffect
. Same thing also applies foruseNavigate
anduseLocation
hooks, instead of using these hooks, you can use thewindow.location
, you can uselocation.open
orlocation.href
for navigation andlocation.search
for getting the URL params.You may also need to use
await
instead ofthen
for the api request. 🚀