5

当您使用OmniAuth通过 Facebook 登录 Web 应用程序时,这些是 Web 应用程序拥有的权限:

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@email.com

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

而当您使用mini_fb gem 将 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@email.com ·

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来请求额外的权限?

4

2 回答 2

10

:scope您可以使用属性检查选项:

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

检查Facebook 权限文档您真正想要的范围,并通过:scope选项上的命令单独定义它。

如果你使用初始化器来定义你的 OamniOauth,就像这样:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 'APP_ID', 'APP_SECRET', {:scope => 'email,offline_access, your,scope,you,want'}
end
于 2010-10-31T08:15:33.227 回答
0

如果您正在使用 devise(像我一样),最简单的解决方案是在 Gemfile 中同时包含“devise”和“omniauth-facebook”。然后在您的设计初始化程序中,您可以添加:

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

这可以很好地解决问题。添加带有设计设置的omniauth初始化程序

于 2012-08-19T10:40:50.553 回答