Does anyone have some example code showing how to use a client credentials grant flow to to then call an oauth protected API with the MAG SDK ?
The docs are pretty useless.
It talks about setting the grant flow here:
but not then what you are supposed to do after that. I'd still expect some sort of 'login' to get a token (albeit one issued on a CC grant)... but none of the MASFoundation login methods seem appropriate.
flow I want here:
- an API on GW is secured to allow only Client credential granted tokens access (it is a password reset API so no user can be logged on at this point)
- policy on GW easy enough and already written (checks subscriber_id is trusted client name)
In non SDK use, app would simply call the /token API asking for a grant of client_credentials and passing client id, and secret. Get token back, and then use this token to call the protected API.
Now, I'm assuming this is also possible with the SDK as it mentioned client credentials grant flow, but it seems to be only half described (MAS.setGrantFlow(MASConstants.MAS_GRANT_FLOW_CLIENT_CREDENTIALS);)
what then ? I'd expect to have to do a CC login before I contruct the call to my protected API surely ?