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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:10:29+00:00 2026-05-25T16:10:29+00:00

I am new to Ruby On Rails & developing a web application with Facebook

  • 0

I am new to Ruby On Rails & developing a web application with Facebook connectivity implemented in it. I am using omniauth & fb_graph gem to authenticate user & to get user’s information.

While posting user’s post on our site to his facebook wall, I am facing issues in two different use cases:

  1. If user updates duplicate status message in my application I am getting following exception

    FbGraph::Unauthorized (OAuthException :: (#506) Duplicate status message):
    
  2. If suppose user changes his facebook password then the user’s access token which I get from omniauth becomes invalid & I get following exception

    FbGraph::Unauthorized (OAuthException :: Error validating access token: Session 
    does not match current stored session. 
    This may be because the user changed the password since the time the session 
    was created or Facebook has changed the session for security reasons.):
    

I am currently doing this but I want to perform two different actions for two differnt exceptions. If status message is duplicate, it should handle the first excepion.

In 2nd exception it should ask to reconnect the facebook account to my application so that I can get the new access token.

Please help.
Thank you.

  • 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-25T16:10:30+00:00Added an answer on May 25, 2026 at 4:10 pm

    According to the documentation, the exception should have code, type, and message attributes. You can tell determine which action to take based on one of those attributes (all exceptions have message, so that is generally useful, but you may find that code or type is better in this particular instance.

    begin
      # log in and post comment
    rescue FbGraph::Unauthorized => e
      case e.message
      when /Duplicate status message/
        # handle dup code
      when /Error validating access token/
        # handle bad credentials
      else
        raise e
      end
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to RVM and playing with Rails 3 & Ruby 1.9.2 betas... I've got
I want to automate things like: Creating a new Ruby on Rails application with
Im new to Ruby On Rails.Im using Ruby version 1.8.7 and Rails version 2.3.8.I
I'm new to Ruby & Rails, and am currently working on the Rails Tutorial
new to ruby, and rails... but not to the amp stack. my preferred method
I'm beginning to work on a new Ruby on Rails application that is a
I am new to Ruby on Rails, I have completed the Blog Tutorial .
New to both Ruby and Rails but I'm book educated by now (which apparently
I want to create a new rails application and fire up the rails server
new to Ruby so I'm still getting to grips with some of the Rails

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.