Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

"Could not match JWT signature to any of the bindings" error meaning when getting access token?

Avatar

Level 2

I have an app that uses the Privacy API to anonymise user details upon request. The app generates a JWT and sends it to https://ims-na1.adobelogin.com/ims/exchange/jwt to retrieve an access token to use for the Privacy API request. However, following the recent changes to the Adobe I/O console, my app has stopped working. In an effort to get it working again, I have created a new project in the console to use for it. Now when trying to get an access token, I am getting a 400 bad request error with the detail of "Could not match JWT signature to any of the bindings". Can anyone please tell me exactly what causes this specific error? I can't find it mentioned in the documentation.

1 Accepted Solution

Avatar

Correct answer by
Level 2

I've found the answer myself; I was using the incorrect private key.

View solution in original post

9 Replies

Avatar

Correct answer by
Level 2

I've found the answer myself; I was using the incorrect private key.

Avatar

Level 2
Hi JohnnyBravo, which part are you struggling with? And what language are you using?

Avatar

Level 3

Hi BenCrowe, I'm trying to create an app to do the same thing; generate a JWT to get an access token. Could you do me a massive favor and share your code with me? I'm struggling to get my app to work. Much appreciated if possible! Thank you

Avatar

Level 3

Hi BenCrowe, thank you very much for the reply. I'm using C# / console app, and I keep getting the same error you got "Could not match JWT signature to any of the bindings" when I try to get the access token after generating the JWT per the below and posting. I'm certain I have the right key. Below is what I have. Thanks again for any tips, much appreciated!

 

using Microsoft.IdentityModel.Tokens;
using RestSharp;
using System;

using System.IdentityModel.Tokens.Jwt;

using System.Linq;

using System.Text

string key = System.IO.File.ReadAllText(@"C:\[directory....]\private.key");

var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key));

var credentials = new SigningCredentials
(securityKey, SecurityAlgorithms.HmacSha256Signature);

var header = new JwtHeader(credentials);

var payload = new JwtPayload
{  // payload stuff - double checked - values correct
{"exp",'....''},
{ "iss",",,,,,,"},
{"sub","......."},
{"https://.........",true},
{"aud","......."}
};

var secToken = new JwtSecurityToken(header, payload);
var handler = new JwtSecurityTokenHandler();

var tokenString = handler.WriteToken(secToken);

Console.WriteLine(tokenString);
Console.WriteLine("Consume Token");

var token = handler.ReadJwtToken(tokenString);

Console.WriteLine(token.Payload.First().Value);

Avatar

Level 2

Hi JohnnyBravo, I'm afraid I don't know C#. The code I wrote is in PHP for a Linux-based server. All I can suggest is outputting the key data you are reading in somewhere, a debug log or something, to make sure you are reading it correctly. I would also maybe avoid applying the UTF8 coding to the key to see if that helps, it may be changing the value somehow.

Avatar

Level 3
Thank you for the reply BenCrowe. I'm using C#. I'm getting the same error you mentioned you got before "Could not match JWT signature to any of the bindings" when trying to retrieve the access token. I'm sure I'm using the correct private key. How did you put the key into your code? I'm using System.IO and reading the key from a folder on C: drive. Thanks again

Avatar

Level 3
Thank you BenCrowe. I really appreciate your replies and help. I'll try the tips you recommended and see if that does the trick. Thanks again, take care.

Avatar

Level 1

Hi JohnnyBrovo,

I am facing the same issue. Can you please help me.

Avatar

Employee
Employee

Hi @mukeshpatil please feel free to post a new forum question with the exact issue details and we can probably help you out.