【发布时间】:2018-01-10 11:15:20
【问题描述】:
我想通过 android 客户端发送的 Google 授权代码验证用户配置文件,为此,我们必须下载 client_secrets.json 并将其放入我们的 rails 应用程序中。就像这个教程https://developers.google.com/identity/protocols/OAuth2WebServer
但是当我尝试执行此步骤时
require 'google/apis/drive_v2'
require 'google/api_client/client_secrets'
client_secrets = Google::APIClient::ClientSecrets.load
auth_client = client_secrets.to_authorization
auth_client.update!(
:scope => 'https://www.googleapis.com/auth/drive.metadata.readonly',
:redirect_uri => 'http://www.example.com/oauth2callback',
:additional_parameters => {
"access_type" => "offline", # offline access
"include_granted_scopes" => "true" # incremental auth
}
)
Rails 引发错误,提示“未提供 client_secrets.json 文件名和/或无法在搜索路径中找到。” 即使我在 config/client_secrets.json 中插入了 client_secrets.json 也会出现错误
您知道这个解决方案的问题或替代方案是什么吗,谢谢。
【问题讨论】:
标签: android ruby-on-rails json ruby google-plus-signin