사용자를 대신하여 다른 API와 대화 할 수있는 응용 프로그램을 구현 중입니다. 다른 사람들 중에는 github도 포함됩니다. oauth-plugin (https://github.com/pelle/oauth-plugin)을 사용하여 각 API에 대한 인증을 수행합니다. 불행히도 Github에서는 작동하지 않습니다.레일 oauth 플러그인으로 github API에 액세스
class GithubToken < ConsumerToken
GITHUB_SETTINGS={
:site=>"https://github.com",
:request_token_path => "/login/oauth/request_token",
:authorize_path => "/login/oauth/authorize",
:access_token_path => "/login/oauth/access_token",
}
def self.consumer
@consumer||=create_consumer
end
def self.create_consumer(options={})
OAuth::Consumer.new credentials[:key],credentials[:secret],GITHUB_SETTINGS.merge(options)
end
def self.get_request_token(callback_url, scope=nil)
https://github.com/login/oauth/authorize
consumer.get_request_token({:oauth_callback=>callback_url}, :scope=>scope||credentials[:scope]||"")
end
end
인증 프로세스를 시작, 내가 get_request_token 통화 중에 403 오류가 발생합니다 :
여기에 내 현재 GithubToken 구현입니다. request_token_path가 어떻게 든 잘못되었다고 가정하지만 올바른 경로에서 정보를 찾을 수 없습니다. 검색 용어의 일부로 Google 검색 github도별로 도움이되지 못했습니다. 지금 omniauth를 시도 할 것이지만 oauth-plugin의 공급자 기능을 사용할 계획이기 때문에 어떤 도움도 많이 받으실 것입니다.