uri = URI('https://api.box.com/oauth2/token')
token_request = Net::HTTP::Post.new(uri)
token_requeste'Content-Type'] = 'application/x-www-form-urlencoded'
token_request.set_form_data(
'client_id' => BOX_CLIENT_ID,
'client_secret' => BOX_CLIENT_SECRET,
'grant_type' => 'client_credentials',
'box_subject_type' => 'user',
'box_subject_id' => BOX_CLIENT_USER_ID
)
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(token_request)
end
I have the above Ruby code which has been giving an access token consistently for the past 6 months. However, yesterday it seems to be no longer providing the access token.
Instead, now I get the response:
{"error"=>"invalid_grant", "error_description"=>"Grant credentials are invalid"}
I verified that the Box Dev App is still Enabled and Authorized. I also checked that the credentials hadn't changed. Is something else going on that I'm unaware of or is there something else that I can check? I did roll the OAUTH2 credentials, but that didn’t work either.