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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:11:17+00:00 2026-06-18T04:11:17+00:00

I am using Rails 3 + fb_graph to post to my own Facebook page.

  • 0

I am using Rails 3 + fb_graph to post to my own Facebook page. I have code that works, but it uses an access token that only works for a couple of hours. And it is very annoying to refresh this access token a couple of times a day. So I registrated for a FB app. I now have:

  my_app = FbGraph::Application.new("App ID");
  acc_tok = my_app.get_access_token("App Secret");
  me = FbGraph::User.me(acc_tok)
  me.fetch
  me.accounts
  account = me.accounts.select {|account| account if account.name == "BoaJobs.com"}.first

  page = FbGraph::Page.new(account.identifier)

  note = page.note!(:access_token => account.access_token, :subject => @title, :message => @message, :link => @url)

But I am getting an error on the me.fetch line:

  OAuthException :: An active access token must be used to query information about the current user.

Can somebody post some code that helps me solve this problem. Thank you very much in advance.

  • 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-18T04:11:18+00:00Added an answer on June 18, 2026 at 4:11 am

    ill refer you to https://github.com/nov/fb_graph/wiki/Page-Management

    where nov states: You need the page’s access token to manage your page.
    Your (an user’s) access token doesn’t work here.

    follow his link to the facebook developers site for more info

    you’ll need the users access_token and i do this through omniauth-facbook https://github.com/mkdynamic/omniauth-facebook

    which you retrieve the use by first inputting this initializer into your app

    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'],
               :scope => 'email,user_birthday,read_stream', :display => 'popup'
    end
    

    (note you can change the permissions on the scope here check facebook developers login permissions for more

    there are some inner workings to omniauth and omniauth-facebook but the jist is
    when you get the callback from facebook you have a rack omniauth hash from the request

    omniauth = request.env["omniauth.auth"]
    

    from that has you can access the users access token like this

    facebook_user_token = omniauth['credentials']['token']
    

    you can then feed that token into your fb_graph page call

    page = FbGraph::Page.new('FbGraph').fetch(
      :access_token => facebook_user_token,
      :fields => :access_token
    )
    

    you will then simply be able to create a note by calling your desired method without a reference to the access token

    note = page.note!(:subject => @title, :message => @message, :link => @url)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.0, I have a small bit of code that I seem to
I have a web application that uses Facebook Connect (built in Ruby on Rails
I am using fb_graph rails gem for posting a message to my user's Facebook
Using Rails 3.2. I have an individual Shop post, and each shop has reviews.
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
(Using Rails 3.1.3) I have an app that manages products. I import the products
I have Ruby on Rails site. Users are allowed to login using their Facebook
I am using fb_graph gem for Ruby on Rails. I want to post a
I have a site that uses the Facebook JavaScript API to allow users to
Using Rails 2.3.8. I have added this in my controller: filter_parameter_logging :password, :password_confirmation But

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.