You need to sign in to do that
Don't have an account?
arjun mohan
Access Token in salesfroce with azure AD
HI All,
My salesforce ORG is SSO Enabled wit Azure AD
Now i need to access Azure Token in my LWC to call other API's hosted in my Azure Org.
Thanks
Arjun.M
Found answer
Here is the code sample
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://login.microsoftonline.com/{tenantID}/oauth2/v2.0/token');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setHeader('Accept', 'application/json');
req.setBody('grant_type=client_credentials&scope=https%3a%2f%2fgraph.microsoft.com%2f.default&client_id={ClientId}&client_secret={ClientSecret}');
HttpResponse res = h.send(req);
if(res.getStatusCode()!=200) {
}
System.debug('res is>>'+res.getBody());