SalesforceCommerceCloud / b2c-crm-sync

... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
https://salesforcecommercecloud.github.io/b2c-crm-sync/
BSD 3-Clause "New" or "Revised" License
64 stars 47 forks source link

Issue with validating that we can retrieve an Account Manager AuthToken #125

Closed aKentorp closed 2 years ago

aKentorp commented 2 years ago

When we run the command npm run crm-sync:b2c:auth:jwt, the response we get is { "error_description": "JWT is not valid", "error": "invalid_client" }

We have succesfully created a self signed certificate and extracted the public and private key. We have added the public key to the B2C client ID. When retrieving an Auth Token through npm run crm-sync:b2c:auth:clientcreds, there are no problems.

We have validated the generated token through https://jwt.io/, and it is valid when using the public and private key. This makes us believe there is some other problem with our request.

Our B2C API client is set up like this MicrosoftTeams-image

Our Self Signed Certificate for JWT Minting CERT

Can you please help us out?

jbachelet commented 2 years ago

Hello @aKentorp, Thank you for opening an issue.

Could you please confirm that the JWT you are using has been exported from the Salesforce Core instance and pasted in the ./_jwt/sdc folder of the b2c-crm-sync folder? Also, can you please confirm that you successfully extracted the JWT from this exported file by running the npm run crm-sync:sf:cert:publickey:get command line? This should create two files in the same folder, one .cert and one .key file with the name of the JWT, so dkmwdev.cert and dkmwdev.key. Then try re-launching the npm run crm-sync:b2c:auth:jwt command.

Thanks

aKentorp commented 2 years ago

Hi @jbachelet We found the error, when running npm run crm-sync:sf:cert:publickey:get we are expected to receive a SF_CERTDEVELOPERNAME but if you have multiple self-signed Certificate, the outputted SF_CERTDEVELOPERNAME might be wrong. In our case the returned SF_CERTDEVELOPERNAME was certbottestialphadkr3it should have been dkmwdev.

You can consider this issue closed, thank your for the time and help.