Last active
February 9, 2018 06:02
-
-
Save Ergin008/f32b5a186a39d4df262d462c7f6a7f4e to your computer and use it in GitHub Desktop.
Step 2 of DocuSign Auth Code Grant, uses the code that was generated from auth_code request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the authorization code that was added as a query param to the redirect URI. | |
// from the previous request. You should set up a route that handles the redirect | |
// and parses the code so you can then pass it to token endpoint: | |
String code = "{ENTER_YOUR_AUTHORIZATION_CODE}"; | |
// assign it to the token endpoint | |
apiClient.getTokenEndPoint().setCode(code); | |
// optionally register to get notified when a new token arrives | |
apiClient.registerAccessTokenListener(new AccessTokenListener() { | |
@Override | |
public void notify(BasicOAuthToken token) { | |
System.out.println("Got a fresh token: " + token.getAccessToken()); | |
} | |
}); | |
// following call exchanges the authorization code for an access code and updates | |
// the `Authorization: bearer <token>` header on the api client | |
apiClient.updateAccessToken(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment