Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:09:42+00:00 2026-05-26T04:09:42+00:00

I am trying to set an oauth2 provider up using up on an application

  • 0

I am trying to set an oauth2 provider up using up on an application which has omniauth and devise already. The user.rb is now:

class User < ActiveRecord::Base

  has_many :authentications
  has_many :graphs

  devise :database_authenticatable,
    :registerable, 
    :recoverable, 
    :rememberable, 
    :trackable, 
    :validatable, 
    :omniauthable, 
    :token_authenticatable,
    :oauth2_providable, 
    :oauth2_password_grantable,
    :oauth2_refresh_token_grantable,
    :oauth2_authorization_code_grantable

.......

}

Everything else is implemented as expected, but I am getting the following error when I run this all locally and try to use the oauth2 gem (0.5.0) to connect to my client.

I end up on:

http://localhost:8080/oauth/callback?code=2ebd3d9d149b22becec37da7a8f1eb0d

which raises the exception:

e.to_yaml
"--- !ruby/exception:OAuth2::Error\nresponse: &70266332040280 !ruby/object:OAuth2::Response\n  response: &70266332040340 !ruby/object:Faraday::Response\n    env:\n      :method: :post\n      :body: ! '{\"error\":\"invalid_grant\",\"error_description\":\"invalid authorization\n        code request\"}'\n      :url: !ruby/object:Addressable::URI\n        validation_deferred: false\n        scheme: http\n        normalized_scheme: !!null \n        uri_string: !!null \n        hash: !!null \n        host: localhost\n        authority: !!null \n        normalized_host: !!null \n        port: 3000\n        normalized_port: !!null \n        path: /oauth2/token\n        normalized_path: !!null \n        query: !!null \n        normalized_query: !!null \n      :request_headers:\n        Content-Type: application/x-www-form-urlencoded\n      :parallel_manager: !!null \n      :request:\n        :proxy: !!null \n      :ssl: {}\n      :status: 400\n      :response_headers:\n        content-type: application/json\n        x-ua-compatible: IE=Edge\n        cache-control: no-cache\n        x-runtime: '0.119701'\n        content-length: '82'\n        server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)\n        date: Wed, 05 Oct 2011 14:40:10 GMT\n        connection: close\n      :response: *70266332040340\n    on_complete_callbacks: []\n  options:\n    :parse: !!null \n  error: !ruby/exception:OAuth2::Error\n    response: *70266332040280\n    code: invalid_grant\n    description: invalid authorization code request\n  parsed:\n    error: invalid_grant\n    error_description: invalid authorization code request\ncode: invalid_grant\ndescription: invalid authorization code request\n"

I am also noticing that no state is provided, which in the latest draft (http://tools.ietf.org/html/draft-ietf-oauth-v2-22) is required for a callback. Could this be an issue?

As for output I am not getting any obvious errors in the server output:

http://pastie.org/2644028

Now, another thing worth noting is that I see a few SELECT’s happening but I never see any data being inserted into the various tables, especially not to authorization_codes which happens just before this exception is thrown.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:09:43+00:00Added an answer on May 26, 2026 at 4:09 am

    I’m no Rails genius but I do know my way around GitHub and I managed to find a few people making commits to their forks. By combining a few valid looking fixes into one location I managed to create a fork that worked fine for me:

    https://github.com/socialcast/devise_oauth2_providable/pull/17

    I set that as my source in Gemfile and now the callback works fine!

    Now, I just need to work out how to stop access tokens expiring, or inject user_id into the darn response somehow… Work work work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up Devise 1.2 to allow user authentication via GitGub. As
Trying to set up caching on our datasets - we're using clr stored procedures
I'm trying to make an OAuth 2.0 Provider and an Android application that is
I am using mac lion and eclipse indigo. I am trying set it up
Lets set the stage Doing a windows phone app, and trying to authenticate using
Alright I am trying to set up an OAuth Provider in PHP, but I
I'm trying to write a facebook application using Java tomcat with RestFB. the restfb
I am trying to set up my Rails application to connect to the google
I have a simple Rails application with which I am trying to use the
I am trying to set up an internal RESTful API using NodeJS that communicates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.