Skip to content

Commit

Permalink
fb_graph ACCESS TOKENs
Browse files Browse the repository at this point in the history
  • Loading branch information
docgecko committed Dec 22, 2011
1 parent 37de7cf commit e1f657f
Showing 1 changed file with 16 additions and 8 deletions.
@@ -1,6 +1,6 @@
--- ---
layout: post layout: post
title: Ruby on Rails fb_graph gem implementation title: Creating Facebook Account and Page access tokens for the fb_graph gem
published: true published: true
categories: categories:
- rails - rails
Expand Down Expand Up @@ -44,7 +44,8 @@ pre. https://www.facebook.com/dialog/oauth?


p. As you enter this url, you will be redirected to your site's url, in my case to http://infrajobshq.com. And now, as you will see from the url, it contains additional information after sites main address, e.g. it looks something like this: p. As you enter this url, you will be redirected to your site's url, in my case to http://infrajobshq.com. And now, as you will see from the url, it contains additional information after sites main address, e.g. it looks something like this:


pre. http://infrajobshq.com/#access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&expires_in=0 pre. http://infrajobshq.com/#access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZA
xQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&expires_in=0


p. As you can see, the url contains the ACCESS TOKEN for your Facebook Account. You will need this for the next step. p. As you can see, the url contains the ACCESS TOKEN for your Facebook Account. You will need this for the next step.


Expand All @@ -54,27 +55,32 @@ pre. https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN


p. Simply replace the ACCESS_TOKEN with your Facebook Account ACCESS_TOKEN (and no need to include the bit on the end of the url that is '&expires_in=0'). In my case, the url looks like this: p. Simply replace the ACCESS_TOKEN with your Facebook Account ACCESS_TOKEN (and no need to include the bit on the end of the url that is '&expires_in=0'). In my case, the url looks like this:


pre. https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD pre. https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4O
sI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD


p. Once you have entered this, you will be given a page that contains your Facebook Page ACCESS_TOKEN, e.g.: p. Once you have entered this, you will be given a page that contains your Facebook Page ACCESS_TOKEN, e.g.:


pre. { pre. {
"data": [ "data": [
{ {
"name": "InfraJobs", "name": "InfraJobs",
"access_token": "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8wLnX3wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD", "access_token": "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8w
LnX3wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD",
"category": "Consulting/business services", "category": "Consulting/business services",
"id": "130231394756745" "id": "130231394756745"
}, },
{ {
"name": "InfraJobs", "name": "InfraJobs",
"access_token": "AAADGIb8OYp4BAMJBpufj6LhsDq2W8JhCpQW6P1zjZCK32uwuK0njrRItJybbfFPXKEOsZCCf4Sfjxkmk4dcJz43OQN8ttOKoPZClOnJZCwZDZD", "access_token": "AAADGIb8OYp4BAMJBpufj6LhsDq2W8JhCpQW6P1zjZCK32uwuK0njrRItJybbfFPXKEOsZCCf
4Sfjxkmk4dcJz43OQN8ttOKoPZClOnJZCwZDZD",
"category": "Application", "category": "Application",
"id": "327845241634422" "id": "327845241634422"
} }
], ],
"paging": { "paging": {
"next": "https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&limit=5000&offset=5000&__after_id=327845241634422" "next": "https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps2
3xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&limit=5000&offset=5000&_
_after_id=327845241634422"
} }
} }


Expand All @@ -86,9 +92,11 @@ p. Anyway, I am using these codes in my App to post to my Facebook Page, so my R


pre. def facebook(message) pre. def facebook(message)
fb_message = message(message) + ": " + job.short_url fb_message = message(message) + ": " + job.short_url
me = FbGraph::User.me("BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD") me = FbGraph::User.me("BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6k
AgtFNm3X4wezyvK7VWEZD")
me.feed!( me.feed!(
:access_token => "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8wLnX3wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD", :access_token => "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8wLnX3
wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD",
:message => fb_message :message => fb_message
) )
end end
Expand Down

0 comments on commit e1f657f

Please sign in to comment.