Saturday, February 24, 2018

Microsoft Flow | HTTP Rest API | Invalid Client Secret error

Issue: You Get "Invalid Client Secret" error even if the same secret key works fine in Postman.

Scenario: You are using HTTP action to call REST API for SharePoint. you successfully get the Access Token however, the same does not work in GET or POST method and errors out with "Invalid Client Secret". Even though the same client secret works perfectly fine in Postman tool.

I have mostly got this error when the Client Secret key has some plus (+) sign or equal (=) sign in the secret. otherwise it does not give me error.


You need to Encode the special characters.

For Example:- This is the Original client secret key. where we have + sign and = sign.


Encode the client secret as below. Replace + by %2B and = by %3D


Now if you run the flow it should work without any errors. 

More Information on special characters

The reserved character "/", for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, "/" needs to be in a path segment, then the three characters "%2F" or "%2f" must be used in the segment instead of a raw "/".

Reserved characters after percent-encoding

%0A or %0D or %0D%0A
Common characters after percent-encoding (ASCII or UTF-8 based)

Arbitrary character data is sometimes percent-encoded and used in non-URI situations, such as for password obfuscation programs, or other system-specific translation protocols.

1 comment:

Alex said...

Hello guys!

I´m having a problem with special characters on the below URL:


Everything works fine, except for the "$" symbol. Debugging my app I got this:


As you can see the "$" symbol was converted to "%24", I searched a lot, but did not find anything that could help me on this issue. I tried to enconde before the REST call, but nothing happen. Does anybody faced this kind of problem before?

Thanks in advance.
Alex Lima.

Total Pageviews