First Pack -- Custom authentification and settings

Hello,

At the edge of 2022, i make a small step to build my first pack. :crossed_fingers:

My pack consist basically of api request whose i would like to reuse the answer.
To do it, i would like to configure a domain, a port and a token to build the url.
Thus i try to use a custom authentification
https://coda.io/packs/build/latest/guides/advanced/authentication/

pack.setSystemAuthentication({
  type: coda.AuthenticationType.Custom,
  params: [
    {name: "ServerToken", description: "The API key"},
    {name: "ServerDomain", description: "The IP address or domain"}, //domain.com
    {name: "ServerPort", description: "The port"}, // default : "32400"
  ],
});

When i build the pack, it seems to work.
Unfortunately when i use my formula, i get an error :
This formula requires a system account, but no system account was provided. Please specify a system account in the pack settings.

And i don’t see any configuration in the settings panel…

I guess i miss a concept. Any idea or advice?

Moreover, if i want to configure a custom domain, how do i have to deal with the addNetworkDomain?

pack.addNetworkDomain("domain.com"); 

Thank you in advance the help.

Hi @j.b_o - Instead of trying to capture the domain and port as custom tokens you’ll want to use the endpoints feature instead. You can read more about account-specific endpoints here:

https://coda.io/packs/build/latest/guides/advanced/authentication/#endpoints

The user would enter the domain and port together in the endpoint field instead of separately. The benefit here is that we just recently made a change where if you require an endpoint domain in your authentication you can make requests to those endpoints without needing to specifically define them as network domains. This only works so long as you don’t explicitly declare a network domain.

Regarding system authentication, I suspect you want to use user authentication instead. You can read more about the differences here:

https://coda.io/packs/build/latest/guides/advanced/authentication/#adding-authentication-to-your-pack

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.