2010-10-31 35 views
5

當您使用OmniAuth登錄到通過Facebook web應用程序,這些都是Web應用程序具有的權限:如何在使用OmniAuth時指定我需要從用戶的Facebook帳戶訪問哪些內容?

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 

當您使用mini_fb寶石鏈接的Web應用程序在Facebook然而,這些都是權限(必須將其指定爲代碼,否則格式化很奇怪):

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 

我使用OmniAuth的時刻,並希望繼續這樣做,但我的應用程序需要更多的權限,像一些額外的人的那mini_fb有。有誰知道我可以如何定製OmniAuth來請求額外的權限?

回答

10

您可以使用:scope屬性的選項檢查:

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

檢查Facebook permissions documentation你真正想要的範圍和定義它:scope選項分開由commant。

如果您使用的初始化定義你OamniOauth,就好像是:

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

感謝您的答案,這正是我需要的。對不起,很煩人,但我究竟會把這條線? – ben 2010-10-31 08:22:17

+0

你把你的Facebook的配置。 – shingara 2010-10-31 08:36:56

+0

感謝您的幫助! – ben 2010-10-31 11:27:57

0

如果您正在使用設計(比如我)最簡單的解決方案是讓這兩個「色器件」和「omniauth Facebook的」在你的Gemfile中。然後在你的設計初始化程序中,你可以添加:

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

這個技巧很好。添加與設計設置omniauth初始化器

相關問題