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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:53:32+00:00 2026-05-20T02:53:32+00:00

Due to Facebook deprecating new FBML, I’m looking for a new way to create

  • 0

Due to Facebook deprecating new FBML, I’m looking for a new way to create a “reveal” tab (a page tab that shows one version to fans and another to non-fans). Facebook has added data to the signed_request:

When a user selects your app in the
left-hand menu, the app will receive
the signed_request parameter with one
additional parameter, page, a JSON
array which contains the ‘id’ of the
Facebook Page your Tab is hosted
within, a boolean (‘liked’) indicating
whether or not a user has liked the
Page, and a boolean (‘admin’)
indicating whether or not the user is
an ‘admin’ of the Page along with the
user info array.

I’m able to read the signed_request fine, but then I need to process it with base64url decoding to get the correct JSON. Additionally, I’ve found in my research that the JSON is improperly formatted for Ruby so needs to be modified prior to decoding it. Here’s the current code (I’m just printing the signed request in index.erb for now):

helpers do
  def base64_url_decode str
    encoded_str = str.gsub('-','+').gsub('_','/')
    encoded_str += '=' while !(encoded_str.size % 4).zero?
    Base64.decode64(encoded_str)
  end

  def decode_data str
    encoded_sig, payload = str.split('.')
    data = ActiveSupport::JSON.decode base64_url_decode(payload)
  end
end

get '/' do
  signed_request = params[:signed_request]
  @signed_request = decode_data(signed_request)
  erb :index
end

I’m trying to keep the application as light as possible and avoid using a full Facebook library as this won’t be a full application (just a tab) and won’t require any additional permissions from users. Any recommendations as to my method for detecting fans are welcome as well.

  • 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-20T02:53:32+00:00Added an answer on May 20, 2026 at 2:53 am

    I’ve run into this before. You just need to pad the end of the payload string with = marks until its length is divisible by 4.

    This will work:

    payload += '=' * (4 - payload.length.modulo(4))
    

    (I’m not sure where/if this is documented by Facebook, but someone on IRC told me about it in early 2011, and sure enough, I’ve since found such padding in the source code of various Facebook client libraries)

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

Sidebar

Related Questions

I've created a simple Facebook Reveal tab, which was working some time ago until
I'm trying to update my tab on a series of pages on facebook. Due
I have created a new Facebook app. Whenever I visit the canvas page (https://apps.fac...)
Due to a number of constraints that I won't get into, I have to
Due to weird domain/subdomain cookie issues that I'm getting, I'd like to know how
I have a website which i integrate with Facebook (via FBML - JavaScript API).
Due to Facebook api restrictions for iOS, I need to be able to send
Currently I am building a site with a Facebook Open Graph integration. One complication
I have a Facebook page, but I dont have a SSL with me, so
I have a Facebook Connect app that I monetize using Google AdSense. I want

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.