"Easy" way to Sign in with Google?

I’m pondering doing a small project as a web app in Crystal, but would rather like to avoid user management and just let people “log in” with Google.

I could spend a lot of time reading up on OAuth/OpenId Connect and hack something together, but I’d rather not.

Are there any Crystal web frameworks that would make it easier?

I didn’t look too deeply into this, but I think you should just be able to follow along with Como usar o OAuth 2.0 para aplicativos de servidor da Web  |  Authorization  |  Google Developers. Using OAuth2::Client - Crystal 1.7.3 to handle the bulk of the work. Would still need to define the endpoints in whatever framework you choose tho, and handle persisting their tokens and such. But should be pretty straightforward.

EDIT: I’m also not aware of any framework that has something like this built in. Crystal frameworks at least.

You can try multi_auth. GitHub - msa7/multi_auth: Standardized multi-provider OAuth authentication

4 Likes

@Blacksmoke16 Well, I was trying to avoid getting into the nittygritty of OAuth. I was kinda hoping for something like Socialite for Laravel with Crystal flavor.

@cyangle
…but this is even better, simple to use but framework-agnostic. Thanks!

I didn’t know about multi-auth either, looks great!

Just made a small proof of concept with multi_auth and kemal to try it out, and disregarding my fumbling due to still being a newbie Crystalist, it was easy-peasy.

Excellent stuff.

7 Likes