Logo

dev-resources.site

for different kinds of informations.

How to oAuth2 Code Flow using Tanstack Start

Published at
1/6/2025
Categories
oauth
javascript
typescript
react
Author
Michael Vogt
Categories
4 categories in total
oauth
open
javascript
open
typescript
open
react
open
How to oAuth2 Code Flow using Tanstack Start

I just developed a Tanstack-Start example for an OAuth2 Code-Flow login to github, google and keycloak.

I wanted to login without any library usage to find out the differences of these identity-providers. And there are many small things like params required, getting the token from auth-code has slightly different fetch requirements, e.g. including params in the POST body instead of query-params etc. .

This example code was inspired by https://www.youtube.com/watch?v=rRn2EisxPl4 but I did not use expressJS because Tanstack has all we need in server-side functions.

https://tanstack.com/router/latest/docs/framework/react/start/server-functions

Here is my example:

https://github.com/progwise/tanstack-auth-examples

Enjoy!
Michael

Featured ones: