Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication

Hello Team,

We are facing issue while calling webhooks API from rails application. Here are the details:

api_client = Hubspot::Client.new(access_token: ‘pat-na1-XXXX-XXXX-XXXXX’)

api_response = api_client.webhooks.settings.settings_api.get_all(app_id: 1400662)

response is NoMethodError (undefined method `settings’ for #Hubspot::Discovery::Webhooks::Client:0x00005598bd71bb68)

After that we removed settings and here it is :

api_response = api_client.webhooks.settings_api.get_all(app_id: XXX2)

the Response is here:

Hubspot::Webhooks::ApiError (Error message: the server returns an error)
HTTP status code: 401
Response headers: {“date”=>“Tue, 31 Jan 2023 17:29:09 GMT”, “content-type”=>“application/json;charset=utf-8”, “content-length”=>“316”, “cf-ray”=>“79242af73c0d8489-BOM”, “strict-transport-security”=>“max-age=31536000; includeSubDomains; preload”, “vary”=>“origin”, “cf-cache-status”=>“DYNAMIC”, “access-control-allow-credentials”=>“false”, “x-hubspot-auth-failure”=>“401 Unauthorized”, “x-hubspot-correlation-id”=>“1baddca4-8de8-4414-b459-ccf85de75240”, “report-to”=>“{\“endpoints\”:[{\“url\”:\“https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=o1N9PWj1MISpBqLdVPjfyP8yBTgrESA1EuuylMtTCHO7f4HC9%2BP2mTkBMlf4XxUCC40VlC95B3Qi5aqxKVFo%2FPu0GMkQuJS35%2BdefMAdImDifRoUkZLt5PQndBjRIuA8\”}],\“group\”:\“cf-nel\”,\“max_age\”:604800}”, “nel”=>“{\“success_fraction\”:0.01,\“report_to\”:\“cf-nel\”,\“max_age\”:604800}”, “server”=>“cloudflare”, “alt-svc”=>“h3=\”:443\“; ma=86400, h3-29=\”:443\“; ma=86400”}
Response body: {“status”:“error”,“message”:"Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview",“correlationId”:“1baddca4-8de8-4414-b459-ccf85de75240”,“category”:“INVALID_AUTHENTICATION”}

Please help us and provide the solution how we have to overcome this issue to move further.

E-mail: nraju@carterandclark.com

Thanks

Raju M

Hey, @NRaju7 :waving_hand: For issues with the Ruby example apps, I suggest you post them in the repo directly – Issues. This is because the developers who support this repo do not post in this community typically.

Best,

Jaycee