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 8292529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:30:43+00:00 2026-06-08T13:30:43+00:00

ok it has been over 5 hours and I am still getting no where.

  • 0

ok it has been over 5 hours and I am still getting no where. What I am trying to do is setup omniauth-gihub gem in one of my Ruby-Sinatra based applications. Following is What I have done yet.

Added the Gems to the Gemfile (& Ran bundler update command ofcourse):

source 'https://rubygems.org'

gem 'sinatra'
gem 'haml'
gem 'shotgun'
gem 'omniauth', :git => 'git://github.com/intridea/omniauth.git'
gem 'omniauth-github', :git => 'git://github.com/intridea/omniauth-github.git'

Under my app.rb file I have the following code:

#imports
require 'rubygems'
require 'bundler'
require 'sinatra'
require 'omniauth'
require 'omniauth-github'
require 'haml'
require './helpers.rb'

#Configure OmniAuth
use OmniAuth::Builder do
  provider :github, ENV['api_key'], ENV['secret'], # Removing the key and secret for security reasons
  scope: "user,repo,gist"
end

#Application Settings
set :sessions, true
set :views, 'templates'


#Get Method for Application Root
get '/' do
  haml :index
end

#Get/Post Methods For Authentication
%w(get post).each do |method|
  send(method, "/auth/:provider/callback") do
    env['omniauth.auth']
  end 
end

The Github application’s settings are as follows:

URL = http://127.0.0.1:4567
Callback URL = http://127.0.0.1:4567/auth/github/callback

Now whenever I visit 127.0.0.1:4567/auth/github/callback I get the following error:

I, [2012-07-26T07:05:23.540462 #30458]  INFO -- omniauth: (github) Callback phase initiated.
E, [2012-07-26T07:05:23.540700 #30458] ERROR -- omniauth: (github) Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, OmniAuth::Strategies::OAuth2::CallbackError
localhost - - [26/Jul/2012:07:05:23 IST] "GET /auth/github/callback HTTP/1.1" 302 9
- -> /auth/github/callback
localhost - - [26/Jul/2012:07:05:23 IST] "GET /auth/failure?message=invalid_credentials&strategy=github HTTP/1.1" 404 448
- -> /auth/failure?message=invalid_credentials&strategy=github
localhost - - [26/Jul/2012:07:05:23 IST] "GET /favicon.ico HTTP/1.1" 404 447
- -> /favicon.ico

it seems it’s not even trying to connect to github, I thought I was already logged in so I logged out of github and try visiting 127.0.0.4567/auth/github/callback again and yes it is not even connecting or sending any information to github.

I have check my api key and the secret and they are correct. I can’t really figure out what am I missing and am really tired. Any help or suggestion will be much appreciated.

EDIT::

Okay I found that the code raising the error is as follows in oauth2.rb

def callback_phase
    if request.params['error'] || request.params['error_reason']
      raise CallbackError.new(request.params['error'], request.params['error_description'] || request.params['error_reason'], request.params['error_uri'])
    end 
    if request.params['state'].to_s.empty? || request.params['state'] != session.delete('omniauth.state')
      raise CallbackError.new(nil, :csrf_detected)
    end

I feel it is something to do with CSRF.

  • 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-06-08T13:30:45+00:00Added an answer on June 8, 2026 at 1:30 pm

    This might be of interest:
    https://github.com/intridea/omniauth-github/issues/12

    I was getting the same error as you, and adding scope: ‘user’ fixed it for me.

    I see you’re already using scope, but the link might put you on the right track.

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

Sidebar

Related Questions

Yesterday I have been testing one single query for over hours and hours, but
I've been scratching my head over this one for a couple hours now, I've
This one has been giving me fits for over an hour... I could swear
I've been trying to debug this error for over three hours now, changing filenames,
I apologize because I know this has been covered over and over again, but
This question has frequently been asked over stackoverflow.com but none of the answers work
I know this has been asked all over the web in various different scenarios,
I am working on an application that has been edited by various programmers over
this has been an ongoing problem with me, ive been trying to make a
I know this question has probably been answered over 200 times and I have

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.