Skip to content

Simple redirect proxy to deal with unauthorized callback error in Google Oauth2

License

Notifications You must be signed in to change notification settings

mynewsdesk/omniauth-redirect-proxy

 
 

Repository files navigation

OmniAuth redirect proxy

Problem

When you need to use OmniAuth with Google on not registered domain in Google Developer console it's a crap.

For example if you would like to use Heroku review apps each time you need to register new domain in the Developer Console to let OAuth work.

Solution

We could use this redirect proxy as a single point for callback which should be registered in Google Developer console.

Redirect proxy will catch up callback request from Google and redirect it back to application.

The trick is – application domain should be encoded with Base64 in the state parameter.

So we will have following flow:

OmniAuth setup

In your app you need setup OmniAuth.config.full_host to http://oauth-redirect-proxy.herokuapp.com

And encode request.base_url with Base64.encode64 in to state parameter.

Deploy

Just deploy to Heroku as regular Ruby application

heroku create
git push heroku master

Install

bin/setup

Quality tools

  • bin/quality based on RuboCop
  • .rubocop.yml describes active checks

Develop

bin/build checks your specs and runs quality tools

Credits

Ruby Base is maintained by Timur Vafin. It was written by Flatstack with the help of our contributors.

About

Simple redirect proxy to deal with unauthorized callback error in Google Oauth2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 66.9%
  • Shell 16.9%
  • Dockerfile 16.2%