For TokenRequest and OAuthRequest objects

Applies to

TokenRequest, OAuthRequest

Description

Specifies the security protocol with the integer value. Values are:

0 – All security protocols except TLS 1.3. This is the default value. It will detect and use the security protocol (except TLS 1.3) in the following order: TLS 1.2, TLS 1.1, TLS 1.0.

1 – TLS 1.0

2 – TLS 1.1

3 – TLS 1.2

4 – TLS 1.3 (experimental). Currently the PowerBuilder native C/S application can support TLS 1.3 only when running in Windows 11 or Windows Server 2022.

Usage

In scripts

The SecureProtocol property takes an integer value. The following example sets the SecureProtocol property to use TLS 1.0:

TokenRequest lnv_TokenRequest
lnv_TokenRequest.secureprotocol = 1

The following example sets the SecureProtocol property to use TLS 1.3, and if TLS 1.3 is not available, uses the security protocol that is detected in the following order: TLS 1.2, TLS 1.1, SSL 2.0, SSL 3.0, TLS 1.0:

lnv_TokenRequest.TokenLocation = "https://test.appeon.com/v1/oauth2/token"
lnv_TokenRequest.Method = "POST"
lnv_TokenRequest.GrantType = "client_credentials"
lnv_TokenRequest.ClientId = "Af-Bf-ZPrD0j1aXrGRsnAgx2-rcuE-ZTQOr9mEvqsi"
lnv_TokenRequest.ClientSecret= "EH2OWHgxMgyKc-tN_EGZAh0Kg4-XS8AQi26vEJh"
lnv_TokenRequest.secureProtocol = 4;
ln_rtn = inv_OAuthClient.AccessToken(lnv_TokenRequest, lnv_TokenResponse)
if ln_rtn = -19 then
  lnv_TokenRequest.secureProtocol = 0;
  ln_rtn = inv_OAuthClient.AccessToken(lnv_TokenRequest, lnv_TokenResponse)
end if
lnv_OAuthRequest.secureProtocol= 4
lnv_OAuthRequest.Method = "GET"
lnv_OAuthRequest.URL = "https://test.appeon.com/product/100"
lnv_OAuthRequest.SetAccessToken(ls_AccessToken)
ln_rtn = inv_OAuthClient.RequestResource(lnv_OAuthRequest, lnv_ResourceResponse)
if ln_rtn = -19 then
  lnv_OAuthRequest.secureProtocol= 0
  ln_rtn = inv_OAuthClient.RequestResource(lnv_OAuthRequest, lnv_ResourceResponse)
end if