Is it possible to use an AuthProvider as a second auth? #11622
Unanswered
adevinwild
asked this question in
Q&A
Replies: 1 comment
-
|
I've encountered this problem too. I've been struggling for three days; the development structure is too confusing. I'd like to see the actual working code for the Google integration, because I couldn't get it to work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey folks!
I'm currently building @perseidesjs/auth-otp, a plugin that allows developers to use OTP into their apps.
So far the plugin works well when using it as a primary auth provider.*
Why "primary" ?
Let's imagine that you have an ecommerce in production at the moment, and that your
customersconnect using the default provideremailpass, customer accounts have already been created using this AuthProvider, so if we want to authenticate using a new provider, we would have to:1 - Retrieve the token using the route
auth/{actor_type}/{auth_provider}/register2 - Create a customer using this token
In order to be able to link an AuthIdentity to an ActorType.
However, it is impossible once the customer has been created, in fact, we will always get a duplication error.
Current solution
So far my idea has been to potentially create a new function that would execute SQL queries at the time of OTP authentication, in order to inject into the
AuthIdentitycreated, the right data inapp_metadatathat allows the link to be made between anActorTypeandAuthIdentityIt works, but I find the approach a little too shaky and I have the impression that it is the only one?
Flow
Sharing with you my current flow, where the most interesting part is when the OTP is valid and that the auto linking process is triggered.
As I said, I found it a bit clunky right now and love to learn how I can improve this approach or even just remove it and let the developers handle this on their side? But again, I'd love to make sure devs don't have to handle this part 🤔
Beta Was this translation helpful? Give feedback.
All reactions