Last active
January 17, 2020 10:42
-
-
Save ldclakmal/2e98a334d489f8e9fe09e1f579210122 to your computer and use it in GitHub Desktop.
Ballerina OAuth2 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 oauthClient { | |
url: "https://www.example.org/api/v1", | |
auth: { | |
scheme: http:OAUTH2, | |
accessToken: "yf29.PlrfBb0gtDFXsbnE_LcDCG-Dz3djEp05zM9y-IPR8CsZz90XwOEyrhqeXPPYxubY9RHMIFzoV2", | |
clientId: "50332352747-270vchcnbhbl4gfn1v91hl0fru.apps.example.org", | |
clientSecret: "PrfEadE4s2SDG4hJ", | |
refreshToken: "5/lk-u0Ywefgh52-v0_OLOkDhlsA9xIadf4qqD3TMQvc", | |
refreshUrl: "https://www.example.com/oauth2/v3/token" | |
} | |
}; | |
public function testOAuth() { | |
string requestPath = "/employees"; | |
var response = oauthClient -> get(requestPath); | |
io:println(response); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment