Authorization for Breezeway API

Hello team,

I’m trying to connect to Breezeway’s API , but I can’t find a solution.

  1. Their Authorization step to get a valid token is the following:

  2. Their Token Refresh endpoint is the following:

I have tried the AuthenticationType.OAuth2 configuration to be able to refresh the token automatically when it expires, but I’m not even able to authorize the API in the first place:

pack.setUserAuthentication({
  type: coda.AuthenticationType.OAuth2,
  authorizationUrl: "https://api.breezeway.io/public/auth/v1/",
  tokenUrl: "https://api.breezeway.io/public/auth/v1/refresh",
  credentialsLocation: coda.TokenExchangeCredentialsLocation.Body,
  additionalParams: {
    access_type: "offline",
    prompt: "consent",
  },
});

My assumption is that the authorization step tries to do a GET by default and it’s not passing the client_id and client_secret in the Body as the Breezeway API requires it.

Any ideas on how to achieve a successful connection? Maybe I have to do something more Custom?

Happy to provide more details, and thanks in advance :slight_smile:

Hi @Jorge_Conde - Unfortunately that API doesn’t look like it’s directly compatible with any of our authentication methods. They use a pattern that is somewhat similar to OAuth2, but not close enough to work with our implementation.

I think you could try to use Custom authentication, like this:

  1. Setup Custom authentication, with parameters for the client ID and secret.
  2. At the start of every execute function in your Pack, make a request to get a new token using the client ID and secret.
  3. Use the access token in the remainder of the execute function to authenticate requests.

This approach could run into issues however if the API invalidates old tokens when creating new ones, as Coda formulas can be run simultaneously. It’s worth a shot though!

Hi @Eric_Koleda , that approach is working great so far.
Thanks a lot for your help!

1 Like

Hi @Jorge_Conde - Please let me know how your pack goes! Would be super keen to check it out!

Hey @Colin_Forrester , will do! I wasn’t planning on making it a public Pack but it shouldn’t take me that long to release it. Are you a Breezeway user? What’s your use case? I’d be happy to chat and share ideas with you.

Interested here as well @Jorge_Conde - can you publish it?