Permalink
Browse files

Add a more complete example

  • Loading branch information...
nono committed Dec 11, 2011
1 parent 44b2898 commit 315e240866f179577f5161571a216afd10ee29bc
Showing with 33 additions and 3 deletions.
  1. +33 −3 README.md
View
@@ -9,9 +9,39 @@ on the [LinuxFr.org Applications Page](https://linuxfr.org/account/applications)
Basic Usage
-----------
- use OmniAuth::Builder do
- provider :linuxfr, ENV['LINUXFR_KEY'], ENV['LINUXFR_SECRET']
- end
+```ruby
+#!/usr/bin/env ruby
+# encoding: utf-8
+
+require 'sinatra'
+require 'omniauth'
+require 'omniauth-linuxfr'
+
+
+use Rack::Session::Cookie
+use OmniAuth::Builder do
+ provider :linuxfr, ENV['LINUXFR_KEY'], ENV['LINUXFR_SECRET']
+end
+
+
+get '/' do
+ <<-HTML
+ <a href="/auth/linuxfr">Se connecter avec LinuxFr.org</a>
+ HTML
+end
+
+get '/auth/linuxfr/callback' do
+ auth = request.env['omniauth.auth']
+
+ <<-HTML
+ <ul>
+ <li>login: #{auth.info.login}</li>
+ <li>email: #{auth.info.email}</li>
+ <li>date: #{auth.info.created_at}</li>
+ </ul>
+ HTML
+end
+```
Copyright

0 comments on commit 315e240

Please sign in to comment.