I have created a power automate flow using the "When a HTTP request is received", and i defined that it can only be called using 2 service accounts (the 2 service accounts are internal users inside our office 365 tenant):-
now when we tried to call this workflow end point from our code:-
HttpRequest req = new HttpRequest();
req.setEndpoint('
https://prod-10.westus.logic.azure.com:443/workflows/******/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=******');
req.setMethod('POST');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization', 'Bearer '+ accessToken);
Map<String, String> reqBody = new Map<String, String>{
******
};
req.setBody(JSON.serialize(reqBody));
HttpResponse res = new Http().send(req);
system.debug('Power automate status code ----> ' + res.getStatusCode());
system.debug('Power automate body -----> '+ res.getBody());
we got this error :-
{"code":"DirectApiRequestHasMoreThanOneAuthorization","message":"The request has SAS authentication scheme, 'Bearer' authorization scheme or internal token scheme. Only one scheme should be used."}}
any advice on this please? now if we define that anyone can call the flow, the flow will be called correctly without issues.
I think the following link may be used for the detailed procedure.