Any examples/tutorials on using oauth2 module?

I am trying to add a “Google Sign in” button in my web app.
For this I am trying to use the oauth2 module, but the details for the usage of this module (outside of the docs) are almost non existent.

I am specially interested in understanding how to implement sessions, cookies, refresh token etc in my crystal code.

Has anyone been able to implement GSI in their web app using crystal? Can you please point me to the relevant code?

You can take a look at GitHub - straight-shoota/openid_connect: OpenID Connect implementation for Crystal. It’s about OpenID connect, but that’s just an OAuth2 application. You can definitely learn about how to use the API, or maybe that shard could already help reach your goal. It works well with GitHub - straight-shoota/http-session: Type-safe sessions for `HTTP::Server` btw.

Note that both shards are basically prototypes and (to my knowledge) not used or tested in production (they have test suites though).

2 Likes