W
Wasp-langβ€’9mo ago
pr0age

Use Oauth protocol with other than Google or Github

We want to integrate with Keycloak Oauth, but it doesn't seem to be possible. Since Oauth it's and standard, shouldn't be a method to integrate with any system using Oauth and not just Google or Github?. I mean, it'd be good if you can customize Oauth integration with any given system that offers this protocol
13 Replies
miho
mihoβ€’9mo ago
In theory each oauth provider is the same... But there are subtle differences how each one of them works. You'll notice there are maaaany different libraries for a lot of oauth providers. For each, was has to pick a lib and do a bit of setup to make it work. So, with the current Wasp setup there isn't a simple way to get Keycloak support. You could try doing something with custom API endpoints and installing some Keycloak library for Node.js I do have some good news for the immediate future, we'll be moving to Artic as our library for oAuth https://github.com/pilcrowOnPaper/arctic They support many providers at once and Keycloak is one of them. We'll integrate Arctic in Wasp and support all of the providers they support 😊
GitHub
GitHub - pilcrowOnPaper/arctic: OAuth 2.0 clients for popular provi...
OAuth 2.0 clients for popular providers. Contribute to pilcrowOnPaper/arctic development by creating an account on GitHub.
martinsos
martinsosβ€’9mo ago
@pr0age by when do you need support for Keycloak?
pr0age
pr0ageβ€’9mo ago
Thank you guys. Having Arctic seems to be the solution, but we need to finish the project by the end of March. I guess you won't have it by then, right?
martinsos
martinsosβ€’9mo ago
We might actually have it quite soon. Let us discuss it internally a bit, to figure out the timeline. We wanted to do it soon anyway, we could push it forward a bit.
pr0age
pr0ageβ€’9mo ago
That would be great. Nevertheless, we wouldn't like to cause you any issues
martinsos
martinsosβ€’9mo ago
No worries, we won't do it if it would be detrimental to general trajectory of Wasp, but in this case we wanted to do it anyway and this might be a good push. Will let you know soon!
pr0age
pr0ageβ€’9mo ago
thank you! Meanwhile, we are trying to workaround the problem. We succeeded at connecting with keycloak via custom api action, and we managed to inject the token in all the rest of request to backend, but we're struggling right now how to inject the user object in the "context" param of "query" requests
martinsos
martinsosβ€’9mo ago
Oho nice job! I think the most likely route would be if you defined your own custom global middleware (Wasp has suport for that) that would, upon detecting your token in the request, obtain the user based on it (via Prisma) and inject it into req. @miho do you have a better idea? As for Arctic, we had a short discussion, and I think we are likely to have Wasp with it in ~ a month, maybe sooner. That would mean by/before mid of March.
pr0age
pr0ageβ€’9mo ago
that sounds great! Thank you! I'll keep you updated and I'll check if I can share some more details about our project with you!
miho
mihoβ€’8mo ago
@pr0age Hey hey, a month has passed and Keycloak support is here πŸ˜„ https://wasp-lang.dev/docs/auth/social-auth/keycloak
Keycloak | Wasp
Wasp supports Keycloak Authentication out of the box.
miho
mihoβ€’8mo ago
Let me know how it works for you and if you encounter some issues with the setup!
pr0age
pr0ageβ€’8mo ago
Thank you guys! I'm telling the dev team to take a look into it. I'll bring back feedback asap. Thanks again!
Filip
Filipβ€’8mo ago
You're very welcome. Good luck with the implementation! As Miho said, don't hesitate to ask us for help πŸ™‚
Want results from more Discord servers?
Add your server