Mule OAuth2 using Client Credentials as grant_type

 ̄綄美尐妖づ 提交于 2019-12-02 13:00:27

It would help if you share your connector code.

However if you are using client-credentials flow, using the @OAuth2 annotations is probably not the way to go as this uses HTTP GET to redirect to the service provider.

As this grant type doesn't require redirection or callbacks, typically you just pass the credentials in as basic auth or in the POST body to a token endpoint.

You're better off using connection management features of Devkit and using a http client to call out to your token endpoint and store the token endpoint in the @Connect method:

http://www.mulesoft.org/documentation/display/34X/Implementing+Connection+Management

private String token;
@Connect
    public void connect(@ConnectionKey String clientKey, @Password String clientSecret)
            throws ConnectionException
    {
        //HTTP client to call token endpoint:
        //curl -u TestClient:TestSecret https://api.mysite.com/token -d 'grant_type=client_credentials'
        this.token = "extract from response"
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!