I am getting 401 unauthorized issue when trying to make yammer API calls mentioned here. I have created an app from app registrations on Azure portal and provided below permissions
And I have used post method to generate token using below parameters:
Access Token URL: https://login.microsoftonline.com/organizations/oauth2/v2.0/token
Client ID: {App client ID}
Secret: {App client secret}
Scope: https://api.yammer.com/.default
GrantType : client_credentials
Using above post request I am able to generate token but with this token I am not able to authorize yammer API calls
But I am able to authorize yammer API calls and able to get response back successfully when I have generated bearer token with grant_type='authorization_code',
scope='https://api.yammer.com/user_impersonation',
redirect_uri='http://localhost',
Auth endpoint='https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/authorize',
Client ID: {App client ID},
Secret: {App client secret} But GrantType : authorization_code always prompt us for user credentials. So, to avoid this I have used 'client_credentials' but it get fails at authorization.
Could any one help me how to authorize yammer API calls using AAD tokens with GrantType : client_credentials or any other way to make yammer API calls successfully with out prompting for user credentials?