Last active
January 17, 2020 10:41
-
-
Save ldclakmal/e88e6fea08c012aaab05357b155b436b to your computer and use it in GitHub Desktop.
Ballerina bearer token authentication
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
endpoint http:Client bearerTokenAuthClient { | |
url: "https://www.example.org/api/v1", | |
auth: { | |
scheme: http:OAUTH2, | |
accessToken: "yf29.PlrfBb0gtDFXsbnE_LcDCG-Dz3djEp05zM9y-IPR8CsZz90XwOEyrhqeXPPYxubY9RHMIFzoV2" | |
} | |
}; | |
public function testBearerTokenAuth() { | |
string requestPath = "/employees"; | |
var response = bearerTokenAuthClient -> get(requestPath); | |
io:println(response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment