使用Google API客户端gem我无法传递fetch_access_token!
方法。我一直收到错误Authorization failed. Server message: {error: invalid_grant}
key = Google::APIClient::KeyUtils.load_from_pkcs12(file, passphrase)
client = Google::APIClient.new
client.authorization = Signet::OAuth2::Client.new(
token_credential_uri: "xxxx",
audience: "xxxx",
scope: "xxxx",
issuer: "xxxx", # the service account email
signing_key: key,
)
client.authorization.fetch_access_token!
当我举起client.authorization.grant_type
时,我得到了:
urn:ietf:params:oauth:grant-type:jwt-bearer