Hi,
I’m using Rails 4.2.3. I’m trying to enable external authentication via DigitalOcean, using the tutorial but I”m running into some problems. I have registered my application with DigitalOcean (using the callback http://localhost:3000/users/auth/digitalocean/callback) and gotten my client ID and secret, which I have added into config/initializers/devise.rb
config.omniauth :digitalocean, “myid”, “mysecret”
config.omniauth :google, “Myid”, “MySecret”
and I have added the callback to app/controllers/callbacks_controller.rb
def digitalocean
@user = User.from_omniauth(request.env["omniauth.auth"])
logger.debug "user: @user"
sign_in_and_redirect @user
end
However, when I link to DigitalOcean from my application home page and then click on the “Authorize Application” from this page on DigitalOcaen’s site — https://cloud.digitalocean.com/v1/oauth/authorize?client_id=myid&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Fdigitalocean%2Fcallback&response_type=code&state=b97390521c4edf54c6331d849fb8597dc6c15795c0cbfe8c , I am getting this error in my log
E, [2016-01-24T14:56:26.493450 #36584] ERROR -- omniauth: (digitalocean) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
What do I need to configure where to allow things to work properly?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
What version of the omniauth-oauth2 gem do you have installed? It seems there was a change introduced that broke a number of omniauth providers. While we put a workaround in place directly in omniauth-digitalocean, pinning the version of omniauth-oauth2 to 1.3.1 should resolve the problem. In your Gemfile, use:
gem 'omniauth-oauth2', '~> 1.3.1'
Let us know if that resolves the problem for you!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.