/// <summary>
        /// GetBearerToken will swap the provided accessCode and clientSecretKey for a bearer token.
        /// The bearer token is essentially the session id for the caller on behalf of the user who
        /// produced this access code.
        /// </summary>
        /// <param name="client">DigivanceClient</param>
        /// <param name="accessCode">The access_code returned from Digivance auth process</param>
        /// <param name="clientSecretKey">Your product's clientSecretKey</param>
        /// <returns>The bearer token that can be used to call functions on behalf of this user</returns>
        public async static Task <string> GetBearerToken(this DigivanceClient client, string accessCode, string clientSecretKey)
        {
            BearerTokenRequest bearerTokenRequest = new BearerTokenRequest {
                AccessCode      = accessCode,
                ClientSecretKey = clientSecretKey
            };

            HttpResponseMessage response = await client.PostAsJsonAsync($"{client.BaseAddress}/auth/bearertoken", bearerTokenRequest);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                string payload = await response.Content.ReadAsStringAsync();

                ErrorResponse res = JsonConvert.DeserializeObject <ErrorResponse>(payload);

                throw new Exception(res.Message);
            }

            client.BearerToken = client.GetCookie("BearerToken");
            return(client.BearerToken);
        }