klaviyo-api-ruby icon indicating copy to clipboard operation
klaviyo-api-ruby copied to clipboard

How do I use the SDK with Bearer access tokens?

Open esb opened this issue 1 year ago • 2 comments

I'm not finding anything that allows me to use the SDK using a bearer access token from an OAuth2 authintication.

Surely the package isn't missing this kind of support?

esb avatar May 29 '24 03:05 esb

OAuth isn't currently support but will be coming shortly.

Ian-Montgomery-Klaviyo avatar Jun 06 '24 17:06 Ian-Montgomery-Klaviyo

It is however possible to bypass the api key and just pass your header in as a header parameter

KlaviyoAPI.configure do |config|
# don't put api-key here like normal
end

key = "Bearer #{$YOUR_TOKEN_KEY}"
response = KlaviyoAPI::Accounts.get_accounts({
  header_params: {
    'Authorization': key,
  },
})

Ian-Montgomery-Klaviyo avatar Jun 06 '24 17:06 Ian-Montgomery-Klaviyo