Skip to content

Instantly share code, notes, and snippets.

@ldclakmal
Last active January 17, 2020 10:41
Show Gist options
  • Save ldclakmal/e88e6fea08c012aaab05357b155b436b to your computer and use it in GitHub Desktop.
Save ldclakmal/e88e6fea08c012aaab05357b155b436b to your computer and use it in GitHub Desktop.
Ballerina bearer token authentication
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