iSHARE Community Forum

Valid AUD Claim

I’m struggling to get access token.
What could be the correct ‘aud’ claim for valid iSHARE identifier of the server?
Cannot find anywhere in documentation.

Hi!

If you are trying to get an access token from the Scheme Owner, check out this part of the documentation. If you are trying to figure out the client_assertion, check out how iSHARE JWTs look.

You are probably looking for the party identifier of the Scheme Owner in this case: EU.EORI.NL000000000

Thank you.

I’m trying to get an access token from the Scheme Owner but I get:
{“error”: “invalid_client”}

What I did:

-Add x5c parameter to header that consist of last three blocks of certificate as array.
-Construct payload:
payload = {
“iss”: “Our Company Identifier”,
“sub”: “Our Company Identifier”,
“aud”: “EU.EORI.NL000000000”,
“jti”: “ae043e1-7f322sdf-ecc9182”,
“exp”: epoch+30,
“iat”: epoch
};
-Sign with private key using RS256 algorithm
-Get JWT.

Then:

Send post request to https://scheme.isharetest.net/connect/token

Post request body:
grant_type=client_credentials
scope=iSHARE
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertion= JWT
client_id=Our Company Identifier

What could be the possible reason of invalid_client error?

Might have to do with the JWT Header. Could you try:
“alg”: “RS256”,
“typ”: “JWT”,
“x5c”: [ “your certificate string”]

I have created the following JWT just now as an example: This would be the client assertion that ABC Trucking (party_id = EU.EORI.NL000000001) would use if they request an access token from Scheme Owner (client_id = EU.EORI.NL000000000). You can decode it online at jwt.io to see the details.

Client_assertion

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlFZ1RDQ0FtbWdBd0lCQWdJSU45VmlDRGkzQndzd0RRWUpLb1pJaHZjTkFRRUxCUUF3U0RFWk1CY0dBMVVFQXd3UWFWTklRVkpGVkdWemRFTkJYMVJNVXpFTk1Bc0dBMVVFQ3d3RVZHVnpkREVQTUEwR0ExVUVDZ3dHYVZOSVFWSkZNUXN3Q1FZRFZRUUdFd0pPVERBZUZ3MHhPVEF5TVRVeE1UUTJNVFZhRncweU1UQXlNVFF4TVRRMk1UVmFNRUl4RlRBVEJnTlZCQU1NREVGQ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BA_J-gqAHSxtQYvHSkYV9fkmlVB063N6A_fdFAtb36L4pNvXncw2noRZ4WKSC06DPZhjXOYgZW53U2ehzpCnyQqEASsLZvqBYtKbgW-gaHndxqwJiTZOWrvLEctf1dr5NTFlvODULWBRgR54cp7_iK0qep1tx_eWzSU-Ypnx7_gSE0lIUdc7TEtjxngIFeDKoIIofZ1StIigKg3LVmH6gs62CYU8ZK4eltKRQmPx_2JHIjL7clC1zz_eMP-8n_fLnar3wwhvj8nzSvWD8Wfy_9dw

At this page, Example of JWT header’s x5c parameter has 3 blocks of certificate.

However, at this page Example of JWT header’s x5c parameter has 1 block of certificate.

My header looks like this:

{
“alg”: “RS256”,
“typ”: “JWT”,
“x5c”: [
“2nd block of certificate”,
“3rd block of certificate”,
“4th block of certificate”
]
}

Client_assertion that you send me has 1 block of certificate string.

Can you be more specific for x5c parameter?

The “x5c” value for you should contain as the first element of that array your own certificate, i.e. the string that starts with

“MIIEgzCCAmugAwIBAgIIWV0mf7ygumAwDQYJKoZ…” (your certificate)

without linebreaks.

To get an access token from the scheme owner on test network, it works if you only provide your own certificate. In general in iSHARE you correctly refer to

  • Signed JWTs MUST contain an array of the complete certificate chain that should be used for validating the JWT’s signature in the x5c header parameter up until an Issuing CA is listed from the iSHARE Trusted List (regarding the eIDAS Framework, with all individual CAs listed on the Trusted List, it is expected that this x5c Header only contains the client’s certificate)

I changed my x5c parameter as what you said.
Now my header looks like this:
{
“alg”: “RS256”,
“typ”: “JWT”,
“x5c”: [“MIIEgzCCAmugAwIBAgIIWV0mf7ygumAwDQYJKoZ…”]
}

But still i get {“error”: “invalid_client”}

Edit:

client_assertion

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlFZ3pDQ0FtdWdBd0lCQWdJSVdWMG1mN3lndW1Bd0RRWUpLb1pJaHZjTkFRRUxCUUF3U0RFWk1CY0dBMVVFQXd3UWFWTklRVkpGVkdWemRFTkJYMVJNVXpFTk1Bc0dBMVVFQ3d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TI2NTQ5MjUxNzR9.Z3sYLKsPL-tO9Oy_NCHvNhvRUS78R9ToXH0R7pCrQ6I5NqodhbtSBb6QIt9CGVd0wpzfJH-hbSxT0Xyip6lk5n4-aoPzuT_f4641mxH7JU7nzOLPzWXlUgdA4y2NYD8F6sS1wSIJGUHSsqvz8W3ZBiXHKXCnmSLo_gAgXCt8ituTNuQK7-We3gi6Ur7Rs_W8MUdgARIpaI84DhK1MIyx2vEjBJanVS9jeFeq7A0LQa2t9G-m9d5o8bJRvIos3NoR7ROSoOaMjAPh88RAIhLI9KOKkaShOVfbPjd_7DTA655etf0Ld27wFK0IN3qZdZZKKKt-geuosuJfNgi5MGnbNw

OK, the x5c looks fine, but there are two minor errors in the Payload:

  • “exp” should be in seconds since epoch, it is now in milliseconds
  • “iat” was missing

You have now

{
  "iss": "EU.EORI.NL066826748",
  "sub": "EU.EORI.NL066826748",
  "aud": "EU.EORI.NL000000000",
  "jti": "ae043e1-7f322sdf-ecc9182",
  "exp": 1552654925174
}

Which should be

{
  "iss": "EU.EORI.NL066826748",
  "sub": "EU.EORI.NL066826748",
  "aud": "EU.EORI.NL000000000",
  "jti": "ae043e1-7f322sdf-ecc9182",
  "exp": 1552654925,
  "iat": 1552654895
}

Actually I have ‘iat’ claim but after signing, that claim is dissapears.
I found that, NodeJS JWT module has ‘noTimestamp’ option and I disabled that option.
Now my payload looks like you told me.

But still no chance, invalid_client error

Could you post the client_assertion again?

Updated client_assertion

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlFZ3pDQ0FtdWdBd0lCQWdJSVdWMG1mN3lndW1Bd0RRWUpLb1pJaHZjTkFRRUxCUUF3U0RFWk1CY0dBMVVFQXd3UWFWTklRVkpGVkdWemRFTkJYMVJNVXpFTk1Bc0dBMVVFQ3d3RVZHVnpkREVQTUEwR0ExVUVDZ3dHYVZOSVFWSkZNUXN3Q1FZRFZRUUdFd0pPVERBZUZ3MHhPVEF6TURjeE5ETXhNRGRh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