Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lancejpollard committed Aug 17, 2010
1 parent ca2133e commit 6033898
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
18 changes: 6 additions & 12 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ Go to [`http://localhost:4567/`](http://localhost:4567/), and through the power

get "/profile" do
token = FacebookToken.new(session[:facebook])
me = JSON.parse(token.get("/me"))
@profile = {
:id => me["id"],
:name => me["name"],
:photo => "https://graph.facebook.com/#{me["id"]}/picture",
:url => me["link"]
}
@me = JSON.parse(token.get("/me"))
haml :show
end

Expand All @@ -54,17 +48,17 @@ Go to [`http://localhost:4567/`](http://localhost:4567/), and through the power
%title Passport Sinatra
%body
= yield

@@ index
%form{:action => "/", :method => :post}
%input{:type => :hidden, :name => :oauth_provider, :value => :facebook}
%input{:type => :hidden, :name => :authentication_type, :value => :user}
%input{:type => :submit, :value => "Login with Facebook"}

@@ show
%a{:href => @profile[:url]}
%h1 Your on Facebook!
%img{:src => @profile[:photo]}
%a{:href => @me["link"]}
%h1= "#{@me["name"]}, Your on Facebook!"
%img{:src => "https://graph.facebook.com/#{@me["id"]}/picture"}

The magic happens here:

Expand Down
14 changes: 4 additions & 10 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@

get "/profile" do
token = FacebookToken.new(session[:facebook])
me = JSON.parse(token.get("/me"))
@profile = {
:id => me["id"],
:name => me["name"],
:photo => "https://graph.facebook.com/#{me["id"]}/picture",
:url => me["link"]
}
@me = JSON.parse(token.get("/me"))
haml :show
end

Expand All @@ -48,6 +42,6 @@
%input{:type => :submit, :value => "Login with Facebook"}

@@ show
%a{:href => @profile[:url]}
%h1 Your on Facebook!
%img{:src => @profile[:photo]}
%a{:href => @me["link"]}
%h1= "#{@me["name"]}, Your on Facebook!"
%img{:src => "https://graph.facebook.com/#{@me["id"]}/picture"}

0 comments on commit 6033898

Please sign in to comment.