Skip to content

Instantly share code, notes, and snippets.

@ldclakmal
Last active January 17, 2020 10:42
Show Gist options
  • Save ldclakmal/4302ebc0e9b771cae33866eac9188209 to your computer and use it in GitHub Desktop.
Save ldclakmal/4302ebc0e9b771cae33866eac9188209 to your computer and use it in GitHub Desktop.
Ballerina basic authentication
endpoint http:Client basicAuthClient {
url: "https://www.example.org/api/v1",
auth: {
scheme: http:BASIC_AUTH,
username: "admin",
password: "123"
}
};
public function testBasicAuth() {
string requestPath = "/employees";
var response = basicAuthClient -> get(requestPath);
io:println(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment