Authentication
The WhenFresh API requires all access to be authenticated.
Developer credentials
During development, you can use a refresh token available from your account page to authenticate against the WhenFresh Api.
Create an instance of the WhenFreshApiClient
and set the Credentials
option to use the refresh token:
var devClient = new WhenFreshApiClient(options =>
options.Credentials = new RefreshTokenCredentials("...your refresh token..."));
Deploying your integration
When you are ready to deploy your integration into one of your environments we will provide you with a client_id and client_secret specific to that environment.
Create an instance of the WhenFreshApiClient
and set the Credentials
option to use a client id and secret:
var productionClient = new WhenFreshApiClient(options =>
options.Credentials = new ClientIdCredentials("...client id...", "...client secret..."));
Environment provided credentials
You can use credentials stored in the environment for authentication against the WhenFresh Api.
Create an instance of the WhenFreshApiClient
and set the Credentials
option to use the environment provided credentials:
var client = new WhenFreshApiClient(options =>
options.Credentials = new EnvironmentProvidedCredentials());
Set the WF_CLIENT_ID and WF_CLIENT_SECRET environment variables.
export WF_CLIENT_ID=<your_client_id>
export WF_CLIENT_SECRET=<your_client_secret>
To use Developer credentials stored in your environment set the WF_REFRESH_TOKEN environment variable.
export WF_REFRESH_TOKEN=<your_refresh_token>