This is a follow-up to my explainer over a year ago on how to create a OAuth2 redwood client. I have returned with a feature-complete general-purpose OAuth2 client implementation to share. The purpose of this post is to gather feedback and give back to the community. This code should help pave the way for a native OAuth2 feature for redwood.
Some community members had difficulty implementing their own OAuth clients, and there is no “PassportJS for Redwood”. The only option is to use 3rd-party tooling such as Auth0 and Magic, or roll your own custom solution. The 3rd-party option wouldn’t work for us when building Treasure Chess, since we needed much more customization. The code presented here is our own solution in production today with 45k+ users, and is working with Coinbase, Twitch, Plaid, and Chess. Adding another provider (Twitter, Discord, anything you want) is as easy as creating a new provider file.
Related resources:
- Single Sign On implementation by @Irev-Dev Extending dbAuth with SSO
- Frontend-only OAuth implementation by @realStandal redwoodjs-dbauth-oauth/oauth.ts at main · realStandal/redwoodjs-dbauth-oauth · GitHub
- Gitlab OAuth by @razzeee Oauth implementation via GitLab