繁体   English   中英

在使用OmniAuth时,如何指定用户的Facebook帐户需要哪些访问权限?

[英]How can I specifiy what access I need from my user's Facebook accounts when using OmniAuth?

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

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

您可以使用: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

如果你正在使用设计(像我一样),最简单的解决方案是在你的Gemfile中同时拥有'devise'和'omniauth-facebook'。 然后在您的设计初始化程序中,您只需添加:

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

这样做很好。 使用设计设置添加omniauth初始化程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM