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

  • Home
  • SEARCH
  • 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 7016831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:50:11+00:00 2026-05-27T22:50:11+00:00

Is it possible to call or instantiate OmniAuth given that a authorization code for

  • 0

Is it possible to call or instantiate OmniAuth given that a authorization code for Facebook? Using authenticated referalls Facebook will append a ?code=ABC... to the URL.

Facebook documentation states that after receiving the authorization code one should then request the access token, however upon browsing through the omniauth-facebook gem this code already seems to exist (line 64).

My reason for wanting to integrate with OmniAuth is to avoid duplicating the code just to get authenticated referrals working. Thanks!

  • 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-27T22:50:12+00:00Added an answer on May 27, 2026 at 10:50 pm

    After looking into this two immediate options are available:

    1. Redirect to the Facebook OAuth path.

    2. Use the passsed in code to manually grab all the OAuth info from Facebook.

    Here was some code that does some of the OAuth steps given a code.

    require 'httparty'
    require 'fb_graph'
    
    def self.get_access_token(code, redirect_uri)
      redirect_uri = remove_code_from_redirect_uri(redirect_uri)
    
      response = HTTParty.get(ACCESS_TOKEN_URL, query: { code: code, client_id: FB_APP_ID, client_secret: FB_APP_SECRET, redirect_uri: redirect_uri })
      return unless response.success?
    
      results = Hashie::Mash.new
      response.body.split('&').each do |param| key, value = param.split('='); results[key] = value; end
      return results.access_token
    end
    
    def self.get_auth(access_token)
      user = FbGraph::User.me(access_token).fetch
    
      results = Hashie::Mash.new
      results['info'] = Hashie::Mash.new
      results['credentials'] = Hashie::Mash.new
    
      results['uid'] = user.identifier
    
      results['info']['name'] = user.name
      results['info']['email'] = user.email
      results['info']['image'] = user.picture
      results['info']['nickname'] = user.username
    
      results['credentials']['token'] = access_token
    
      return results
    end
    
    private
    
    def self.remove_code_from_redirect_uri(redirect_uri)
      url, params = redirect_uri.split("?")
      params = params.split('&').inject({}) { |hash, param| k, v = param.split('='); hash[k] = v; hash }
      params.delete("code")
      url + '?' + CGI::unescape(params.to_query)
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code
I'm working on a c++ code that uses SDL/opengl. Is this possible to create
Possible Duplicate: In PHP, can you instantiate an object and call a method on
Is it possible to call a method that is not tagged with [Ajax.AjaxMethod] from
I know that it is possible to call a function with a variable number
Is it possible to call a COM API from Java (specifically the HP/Mercury Quality
Is it possible to call a JavaScript function from the IMG SRC tag to
Is it possible to call into COM objects via x86 assembly language? If so,
is it somehow possible to call a rails function or to access a rails
Is it possible to call a constructor from another (within the same class, not

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.