API Integrator 2016 Java Edition
API Integrator 2016 Java Edition
Questions / Feedback?

BeforeOAuth Event

Fires before an OAuth authentication attempt begins.

Syntax

public void fireBeforeOAuth(ApiclientBeforeOAuthEvent event);

public class ApiclientBeforeOAuthEvent {
  public int grantType;
  public String clientId;
  public String clientSecret;
  public String serverAuthURL;
  public String serverTokenURL;
  public String authorizationScope;
  public String token;
  public String refreshToken;
  public long timestamp;
  public long expiresIn;
}

Remarks

This event will fire before every OAuth authentication attempt, allowing you to specify values for the bean to use during the OAuth authentication process.

If OAuthCacheFile is set to a valid file path and contains values for Token, RefreshToken, or ExpiresIn, then the corresponding event parameters will be prefilled with the cached values.

If RefreshToken is populated and Token is set to an empty string, the bean will attempt to refresh the OAuth token.

If Token is set and ExpiresIn is greater than 0, the bean will attempt to use that token (regardless of whether or not RefreshToken is set).

A Timestamp is required, and is used in conjunction with the ExpiresIn value to determine whether or not the Token is still valid, or if a new Token should be acquired. Timestamp is specified in milliseconds since the Unix epoch, 00:00:00 UTC January 1, 1970. For instance "Tuesday, 19-Dec-17 21:06:21 UTC" would be "1513717581".

The GrantType will be prefilled with the value of the OAuthGrantType property.

After this event fires, the bean will determine whether OAuth authorization is necessary based on the presence or absence of Token, RefreshToken, ExpiresIn, and Timestamp parameters.

If the current token is valid then no OAuth action occurs, and the AfterOAuth does not fire. If OAuth authentication is needed, then after the OAuth process completes, the AfterOAuth event will fire with the parameters used for during the process, as well as any returned parameters like RefreshToken.

 
 
Copyright (c) 2021 /n software inc. - All rights reserved.
API Integrator 2016 Java Edition - Version 16.0 [Build 7709]