2010-10-31 7 views
5

Quando si utilizza OmniAuth eseguire il login per una web app tramite Facebook, questi sono i permessi webapp ha:Come posso specificare quale accesso ho bisogno dagli account Facebook dei miei utenti quando si utilizza OmniAuth?

Access my basic information Includes name, profile picture, gender, networks, user ID, list of friends, and any other information I've shared with everyone. 

Send me email WebApp may email me directly at [email protected] 

Access my data any time WebApp may access my data when I'm not using the application 

Mentre quando si utilizza il mini_fb gemma di collegare una web app per Facebook, questi sono i permessi (necessario specificare questo come codice altrimenti la formattazione era strano):

Access my basic information 
Includes name, profile picture, gender, networks, user ID, list of friends, and any other information I've shared with everyone. 

Required 
Send me email 
WebApp may email me directly at [email protected] · 

Required 
Access my profile information 
Likes, Music, TV, Movies, Books, Quotes, About Me, Activitie...s, Interests, Groups, Events, Notes, Birthday, Hometown, Current City, Website, Religious and Political Views, Education History, Work History and Facebook StatusSee More 

Required 
Online Presence 

Required 
Access my family & relationships 
Family Members and Relationship Status 

Required 
Access my photos and videos 
Photos Uploaded by Me, Videos Uploaded by Me and Photos and Videos of Me 

Required 
Access my friends' information 
Birthdays, Religious and Political Views, Family Members and... Relationship Statuses, Hometowns, Current Cities, Likes, Music, TV, Movies, Books, Quotes, Activities, Interests, Education History, Work History, Online Presence, Websites, Groups, Events, Notes, Photos, Videos, Photos and Videos of Them, 'About Me' Details and Facebook StatusesSee More 

Required 
Post to my Wall 
WebApp may post status messages, notes, photos, and videos to my Wall 

Access messages in my inbox 

Access posts in my News Feed 

Access my data any time 
WebApp may access my data when I'm not using the application 

Access Facebook Chat 

Send me SMS messages 
WebApp may send SMS messages to my phone: 

Manage my events 
WebApp may create and RSVP to events on my behalf 

Access my custom friend lists 

Access my friend requests 

Insights 
WebApp may access Insights data for my pages and applications 

Manage my advertisements 

sto usando OmniAuth in questo momento, e vorrebbe continuare a fare così, ma la mia applicazione ha bisogno di più autorizzazioni, come alcuni di quelli extra che mini_fb ha. Qualcuno sa come posso personalizzare OmniAuth per richiedere permessi extra?

risposta

10

È possibile controllare in opzione utilizzando l'attributo :scope:

use OmniAuth::Strategies::Facebook, 'app_id', 'app_secret', {:scope => 'email,offline_access, your,scope,you,want'} 

Controllare il Facebook permissions documentation quali possibilità si vuole veramente e definirlo separare da un comandate in :scope opzione.

Se si usa un inizializzatore per definire l'OamniOauth, è così:

Rails.application.config.middleware.use OmniAuth::Builder do 
    provider :facebook, 'APP_ID', 'APP_SECRET', {:scope => 'email,offline_access, your,scope,you,want'} 
end 
+0

Grazie per la tua risposta, questo è esattamente ciò di cui avevo bisogno. Mi dispiace essere fastidioso, ma dove esattamente metterei questa linea? – ben

+0

dove metti la tua configurazione di Facebook. – shingara

+0

Grazie per il tuo aiuto! – ben

0

Se si utilizza concepire (come me) la soluzione più semplice è quella di avere sia 'concepire' e 'omniauth-facebook' nel tuo Gemfile. Quindi nel tuo inizializzatore di idea puoi solo aggiungere:

config.omniauth :facebook, "app", "secret", :scope => "user_photos" 

Questo fa abbastanza bene il trucco. Aggiungere l'inizializzatore omniauth con il set-up