How do I use an obtained JWT Token (through rest message) in a flow API call?

Bart Jan Bultma
Kilo Sage

I authenticate to Entra ID by using a certificate. I have created a rest message that uses this certificate to receive a token from entra id.

Now I have to use this token in Flow Designer to do an API call. How do I get the token in a flow action? I can't use REST step action because that one requires a credential, while the token is being saved in an oauth token record.

 

I'm trying to do a flow script step where I start the rest message through restMessage.execute(); but this returns the following error:

{
    "Action Status": {
        "code": 1,
        "message": "Error:  Error constructing REST Message/Method: <REST MESSAGE NAME>/Default GET,Detail: Error constructing REST Message/Method: APIM Azure Entra ID OAuth/Default GET"
    }
}
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Bart Jan Bultma 

why not use script in flow action to get the token and then return that token back to flow so that it can be used?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

@Bart Jan Bultma 

if there is a spoke available from ServiceNow then it might come with pre-defined steps.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Bart Jan Bultma 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader