An example of how to use ankane/blazer-docker with Devise and Google OAuth2 authentication.
- Create a new OAuth 2.0 Client ID:
- Application type: Web application
- Authorized JavaScript origins:
http://localhost
andhttp://localhost:8080
- Authorized redirect URIs:
http://localhost:8080/users/auth/google_oauth2/callback
- Create a
.env
based on the.env.example
and add your Google OAuth2 credentials. - Run
docker-compose up
and access at http://localhost:8080.
All routes are protected by Devise, so you'll need to sign in with Google to access Blazer. Users that are already signed into their Google account will be automatically signed in once they've accepted the consent screen.
To remove Google Sign-in and use server-side sign-in:
- Add
gem "omniauth-rails_csrf_protection"
to theGemfile
. - Delete the
config/initializers/omniauth.rb
file. - Add a sign-in button to
app/views/devise/sessions/new.html.erb
:
<%= button_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path, method: :post %>