Missing required parameter: assertion
Hey guys, Here's my code:
client = OAuth2::Client.new('', '',
site: 'https://accounts.google.com',
authorize_url: '/o/oauth2/auth',
token_url: '/o/oauth2/token',
auth_scheme: :request_body
)
encoding = {
algorithm: 'RS256',
key: self.get_certificate_from_assembly.key,
}
now = DateTime.now
claimset = {
iss: Google::Settings.service_account_email,
scope: "https://www.googleapis.com/auth/youtubepartner",
aud: "https://accounts.google.com/o/oauth2/token",
iat: now.to_i,
exp: (now + 10.minutes).to_i,
}
access = client.assertion.get_token(claimset, encoding)
token = access.token
Whenever I use the gem
directly from rubygems
, I get this error:
OAuth2::Error: invalid_request: Missing required parameter: assertion
{
"error": "invalid_request",
"error_description": "Missing required parameter: assertion"
}
However, when I use it from github gem 'oauth2', git: 'git@github.com:oauth-xx/oauth2.git'
the same code is passing and I'm getting the token.
Is the rubygems
version outdated ? should I keep using the git version until 2.0.0
is released ?