In the BBE https://ballerina.io/learn/by-example/http-client-oauth2-client-credentials-grant-type/, there is an OAuth2 token endpoint configured on https://localhost:9445/oauth2/token.
http:Client albumClient = check new ("localhost:9090",
auth = {
tokenUrl: "https://localhost:9445/oauth2/token",
clientId: "FlfJYKBD2c925h4lkycqNZlC2l4a",
clientSecret: "PJz0UhTJMrHOo68QQNpvnqAY_3Aa",
scopes: "admin",
clientConfig: {
secureSocket: {
cert: "../resource/path/to/public.crt"
}
}
},
How can I set this up? Is there a guide on how to do configure a token endpoint?
Regarding the tokenUrl(https://localhost:9445/oauth2/token): make sure to use the URL configured from the authorization server/IdP. You have the flexibility to choose any IdP that supports ClientCredential grant type. To configure a WSO2 Identity Server, you can refer to this link: https://is.docs.wso2.com/en/6.0.0/guides/access-delegation/client-credentials-playground/. Alternatively, you can explore the client credential grant type in Asgardeo by visiting: https://wso2.com/asgardeo/docs/references/grant-types-in-asgardeo/#refresh-token-grant.