I'm trying to set up a http request in an automation rule.
Hi Steven,
Are you sure about the "webhookResponse" smart value? I know it exists for Jira Data Center but on Jira Cloud I always use "webResponse".
Here is what I have for the Authorization header.
Bearer {{webResponse.body.access_token}}
+ make sure you check this option on the call where you are requesting the token "Delay execution of subsequent rule actions until we've received a response for this web request"
found the issue:
in the post action to get the acces token the 'scope' was not correct. it stated graph.microsoft.com instead of service.flow.microsoft.com
thank you all for the needed help and overthinking.
Hi @Steven Vits
As you are making a call to a Microsoft endpoint, this is providing the 401, not the automation rule in Jira.
So the authorization towards MS not working.
It also states this in the error "The provided authentication token is not valid, token signature is not properly formatted"
Check what authorization is needed at the MS side?
Also to get a token from MS, you first need to be logged in on the MS side, to get an oauth token.
The call you are making is not authorized, with the provided credentials in the post action.
@Marc -Devoteam- , thanks for the reply, the first pist action to Microsoft is succesfull and I do get a reply. Also using postman all is working like it should be.
the second http action should start a power automate flow with the auth token from tje app registration.
@Charlie Misonne thank you for the suggestion. I will check this first thing tomorrow. As I do get a value in the var iI assumed this was correct. It seemed like a newline value JSM was adding to the bearer token.
will keep you posted.
And is what you are getting in the variable the expected value?
I'm doing the same, also to trigger a PowerAutomate flow and I did not have to deal with any newlines in the response.
I'm not storing the token in a variable first. I use the smart value directly as Authorization header. Perhaps this can cause a difference.
This is what the rule looks like:
getting the acces key
storing the key in a variable and audit log for troubleshooting:
And the get action, I also tried with post (also changed in power automate off course)
And the audit log itself:
Have you provided the right headers in the web request in the automation rule.
Postman has many headers set by default, but the web request action not, are the right headers provided to make the call to the MS endpoint?
Have you tried using the token logged by the automation rule in postman? Does it work?
My setup is the same except for the initial call to get the token.
In the payload (custom data) I did not URL encode the data. I'm just using this:
grant_type=client_credentials&scope=https://service.flow.microsoft.com//.default
I also noticed your "scope" is different". Not sure why the reason for that is.
An improvement but certainly not related to your issue:
Again in the custom data: I do not provide client_secret and client_id because you can not encrypt/ mask that part in the automation rule.
The endpoint also supports the Authorization header with the value <client_id>:<client_secret> encoded with base 64.
So:
It looks like you're new here. Sign in or register to get started.