No oauth client details found for https://{domain}.net/ and oauthClientId {id}

I trying get oauth access token for add on. I am getting No oauth client details found for https://{domain}.net and oauthClientId {id} error. Can anyone help me on this?

Request:

url=“https://auth.atlassian.io/oauth2/token”,
headers=>{“Content-Type”=>“application/x-www-form-urlencoded”, “Host”=>“auth.atlassian.io”, “Accept”=>“application/json”}}
method=>“post”,
body=>“grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&scope=READ+WRITE+ACT_AS_USER&assertion={jwt_assertion}”

jwt_assertion config:

{
iss: “urn:atlassian:connect:clientid:#{clientid}”,
sub: ‘urn:atlassian:connect:userkey:{userkey}’,
tnt: ‘https://{domain}.atlassian.net’,
aud: ‘https://auth.atlassian.io’,
iat: issued_at,
exp: expires_at
}

I have tried urn:atlassian:connect:useraccountid instead of urn:atlassian:connect:userkey

Still got the same error.

I will try to recreate this. Are writing the OAuth dance from scratch or are you using a library?

Thanks for the response @scallahan

I have followed the instructions provided by this link User impersonation for Connect apps. I have installed the add-on then got the add-on key and oauthClientId(client_key). I am trying to get access token from the api (https://auth.atlassian.io/oauth2/token). I didn’t get the response. Could you please guide me for this?. Is there any specific configuration needs to be done?

I haven’t use OAuth dance and any library still.

Can you provide what data you passed in the assertion? Were you following this instructions during getting the context? Security for Jira Cloud apps

Hi @scallahan, I have provided the assertion details in the question itself.
Assertion context:

{
iss: “urn:atlassian:connect:clientid:#{clientid}”,
sub: ‘urn:atlassian:connect:userkey:{userkey}’,
tnt: ‘https://{domain}.atlassian.net’,
aud: ‘https://auth.atlassian.io’,
iat: issued_at,
exp: expires_at
}

here client is an add-on client_key and user key is my user_key of jira account.

Hey @arvindk Still trying to get more information to help sort this. Did you install the app first?

@scallahan Yes I have installed the add-on.

I did this Security for Jira Cloud apps

@arvindk This is strange behavior and I have been unable to sort it out so I going to open an DevHelp Ticket

Thanks @scallahan

Is it possible to track the status of the ticket?

@scallahan Is it possible to track the ticket?

Hi @arvindk, Scott here from Atlassian

i just happened upon this thread while doing some of my own development and ran into the same issue. It turned out that i was using the clientKey param from the installation lifecycle call instead of the oauthClientId param. Once I changed that it worked fine.

Give it a shot and let me know if it fixes your issue

1 Like

Thanks @scklein, I used clientKey params, but it is not working. it is showing same error

@scallahan @scklein could you please let me know anything needs to be setup before testing this API?

I didn’t setup the OAuth or anything. Let me know if it is need to be configure?

nothing needs to be set up before testing, but clientKey is the wrong param. you need to be using oauthClientId that comes in in the installed lifecyle hook

3 Likes

Hi @scklein I have tested both clientKey and oauthClientId it was not worked for me. getting the same error.

Hello @arvindk I have been trying to reproduce your issue and the only way I have been able to reproduce is to put in the incorrect clientid. I hope that narrows the scope of your troubleshooting.

I have the same issue however I am not receiving oauthClientId in the request body or query string params. These are the values I am receiving on installed event:
BODY: key, clientKey, publicKey, sharedSecret, serverVersion, pluginsVersion, baseUrl, productType, description, eventType
QUERY: user_key, user_account_id

If you would like you can remix this example if it helps get an idea of how this works
Glitch Example

Not sure if this is still an issue, but after reading what @scklein said, I uninstalled and reinstalled my app checking the payload that came from the installed lifecycle. Low and behold there was an oauthClientId. After using that instead of the clientKey, impersonation worked. I am not sure if it was there before, or if it was only present after I added the ACT_AS_USER scope to my atlassian-connect.json. I don’t recall it being there before, but I can’t say one way or another.

Thanks @scklein!

2 Likes