2013-10-09 2 views
0

이 오류 메시지와 관련된 다른 스레드를 검색 했으므로 해결책을 찾지 못했습니다.레일 사이트가 가입시 페이스 북 게시 권한을 요청하지 않습니다.

인증을 위해 (정확히 작동하고있는) gem 'omniauth-facebook'을 사용하고 특정 컨트롤러 작업이 히트 (모델의 행 생성)되었을 때 facebook에 게시 할 목적으로 'fb_graph'를 사용하고 있습니다.

페이스 북 개발자 도구의 내 앱 설정에서 현재 '게시 스트림'및 '상태 업데이트'권한을 요청하고 있습니다. 또한 사용자 & 친구 권한에 '게시 작업'을 요청하고 있습니다.

처음 로그인 할 때 앱이 게시되기를 바라지 만 아무 말도하지 않습니다. 이게 왜 어떤 아이디어일까요? 아직 SDK를 추가하지 않았습니다. - 이것이 중요한 이유입니까?

다음은 몇 가지 코드

감사합니다!

페이스 북의 초기화 내가 저장 한 후 게시하기 위해 노력하고있어

OmniAuth.config.logger = Rails.logger 
Rails.application.config.middleware.use OmniAuth::Builder do 
provider :facebook, 'my_id', 'my_key', {:scope => 'publish_stream'} 
end 

조치. 이 작업은 내가

을 얻을 당한다 때

'OAuthException : (# 200) 사용자는이 작업을 수행 할 수있는 응용 프로그램을 승인하지 않은'는 me.feed와

을! 강조 표시된 행.

def create 
@sub_opp = SubOpp.new(sub_opp_params) 

respond_to do |format| 
    if @sub_opp.save 
    me = FbGraph::User.me(current_user.oauth_token) 
    me.feed!(
    :message => 'Updating via FbGraph', 
    ) 
    format.html { redirect_to sub_opps_url, notice: 'Sub opp was successfully created.' } 
    format.json { render action: 'show', status: :created, location: @sub_opp } 
    else 
    format.html { render action: 'new' } 
    format.json { render json: @sub_opp.errors, status: :unprocessable_entity } 
    end 
end 

사용자 모델

class User < ActiveRecord::Base 
def self.from_omniauth(auth) 
    where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user| 
    user.provider = auth.provider 
    user.uid = auth.uid 
    user.gender = auth.extra.raw_info.gender 
    user.email = auth.extra.raw_info.email 
    user.name = auth.info.name 
    user.oauth_token = auth.credentials.token 
    user.oauth_expires_at = Time.at(auth.credentials.expires_at) 
    user.image_url = auth.info.image 
    user.save! 
end 

끝 끝

답변

1

이 홀수 - 이것은 실제로 작동합니다. 나는 결코 내가 나의 레일을 다시 시작하지 않았는지 궁금해한다.

위 내용은 모두 페이스 북에 게시하기위한 것입니다.

앱 페이스 북 개발자 도구 설정의 Facebook 권한 섹션에 다음 권한이 있습니다.

사용자 & 친구 권한 : publish_actions 확장 권한 : publish_stream 및 status_update

건배

관련 문제