in packages/forge-viewhubs-netcore-aws/Controllers/OAuthController.cs [127:148]
public static async Task<Credentials> CreateFromCodeAsync(string code, IResponseCookies cookies)
{
ThreeLeggedApi oauth = new ThreeLeggedApi();
dynamic credentialInternal = await oauth.GettokenAsync(
await GetAppSetting("FORGE_CLIENT_ID"), await GetAppSetting("FORGE_CLIENT_SECRET"),
oAuthConstants.AUTHORIZATION_CODE, code, await GetAppSetting("FORGE_CALLBACK_URL"));
dynamic credentialPublic = await oauth.RefreshtokenAsync(
await GetAppSetting("FORGE_CLIENT_ID"), await GetAppSetting("FORGE_CLIENT_SECRET"),
"refresh_token", credentialInternal.refresh_token, new Scope[] { Scope.ViewablesRead });
Credentials credentials = new Credentials();
credentials.TokenInternal = credentialInternal.access_token;
credentials.TokenPublic = credentialPublic.access_token;
credentials.RefreshToken = credentialPublic.refresh_token;
credentials.ExpiresAt = DateTime.Now.AddSeconds(credentialInternal.expires_in);
cookies.Append(FORGE_COOKIE, JsonConvert.SerializeObject(credentials));
return credentials;
}