How to implement Authentication with Multiple OAuth2 Providers?
I have have already implemented email/password auth and now I want to add OAuth2 login with multiple providers (Google and Facebook). I saw the guide for Google, but not sure how to set up multiple providers together.
6 Replies
the DSLs can just sit alongside eachother
Oh yeah, now I understood the purpose of these configs.
Zach, I have previously used Assent so I rolled my own multiprovider module and controller. Is it completely fine if I use Ash only for the upsert action?
I also don't think I need the
identity_resource
config as I'm supporting basic auth based on email upserts.
What do you think, is there something I should be aware of?Yep, 100%
as in its totally fine to do that 🙂
You can do whatever you want to do at the end of the day all Ash cares about is getting an
actor
set for its action calls
So AshAuthentication does a bunch of cool stuff but if it doesn't fit it is actually a pretty clean separation in general.Awesome. Thank you for the great support Zach. Highly appreciated.
I ran into a small issue in the final step, it seems that the change
AshAuthentication.GenerateTokenChange
cannot generate the token if there is no oauth configuration in my User
module (however I am doing this with Assent on my own module as pointed out above)
I'm getting this error when triggering my :register_with_oauth2
action:
Hm...you can configure the oauth strategy with some dummy values, or go open up the changes source and make your own change to generate a token.
Yeah, simply configuring the oauth2 block with dummy/empty values worked
Thanks