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?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!