我在rails中使用google-api-ruby-client gem。
在示例中,我找到了一个加载GooglePlus数据的示例:
client = Google::Apis::PlusV1::PlusService.new
client.key = ENV['GOOGLE_CLIENT_ID']
client.authorization = authorization使用另一种方法(使用devise ),refresh_token I已经获得了 auth_token 和。
如何从我所拥有的令牌开始生成authorization对象?
发布于 2016-02-17 17:02:35
可以通过实例化如下所示的新UserRefreshCredentials来创建授权对象:
authorization = Google::Auth::UserRefreshCredentials.new(
client_id: GOOGLE_CLIENT_ID
client_secret: GOOGLE_CLIENT_SECRET
scope: GOOGLE_SCOPE,
access_token: YOUR_AUTH_TOKEN,
refresh_token: YOUR_REFRESH_TOKEN,
expires_at: YOUR_EXPIRE_AT_TIMESTAMP,
grant_type: 'authorization_code')https://stackoverflow.com/questions/35462464
复制相似问题