-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAuthCheckExample.java
28 lines (25 loc) · 1.19 KB
/
AuthCheckExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import com.signnow.api.auth.request.TokenGetRequest;
import com.signnow.api.auth.response.TokenGetResponse;
import com.signnow.core.ApiClient;
import com.signnow.core.exception.SignNowApiException;
import com.signnow.core.factory.SdkFactory;
public class AuthCheckExample {
public static void main(String[] args) {
// Set your actual input data here
// Note: following values are dummy, just for example
//----------------------------------------------------
// if it is empty or null, a new Bearer token will be created automatically
String bearerToken = "";
try {
ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken);
TokenGetResponse response = (TokenGetResponse) client.send(new TokenGetRequest()).getResponse();
System.out.println("Token: " + response.getAccessToken());
System.out.println("Type: " + response.getTokenType());
System.out.println("Scope: " + response.getScope());
System.out.println("Expires at: " + response.getExpiresIn());
} catch (SignNowApiException e) {
System.err.println("Exception when signNow API call TokenGetRequest");
System.out.println("ERROR: " + e.getMessage());
}
}
}