Atlassian-connect-spring-boot JIRA Rest API via OAuth returning 400 Bad Request with auth server

Hi,
I am using the atlassian-connect-spring-boot framework and having difficulties getting a response from the JIRA Rest API https://developer.atlassian.com/cloud/jira/software/rest/ via OAuth. I have added ACT_AS_USER to the scopes in the app descriptor which is correctly setting the oauthClientId to AtlassianHost after the installation event.

I attempt to retrieve all boards using the following code.

RestTemplate authenticatedRestTemplate = restClients.authenticatedAs(atlassianHostUser);
ResponseEntity<String> response = authenticatedRestTemplate.getForEntity("/rest/agile/1.0/board", String.class);

However, I get a 400 response. After a little digging I see that it is not able to talk to the auth server and I get the message Server returned HTTP response code: 400 for URL: https://auth.atlassian.io/oauth2/token.

Has anyone come across this before? Any help is appreciated.

Cheers.

@hta55 what is the response body returned from the authorization server?

See this post for how to bump the logging level.

1 Like

@epehrson after swapping out the default factory in RestTemplate to HttpComponentsClientHttpRequestFactory and using the HTTPClient from Apache I was able to get the following information from the request.

{“error”:“invalid_grant”,“error_description”:“Deprecated subject claim prefix urn:atlassian:connect:userkey: cannot be used when opted in to GDPR API migration”}

From here I was able to see that some changes were made to the API (https://developer.atlassian.com/cloud/jira/platform/connect-app-migration-guide/) to align with GDPR and are reflected in atlassian-connect-spring-boot in versions >= 1.5.0 … which made me see that the version I was running was wildly out of date for some reason.

tldr; I updated atlassian-connect-spring-boot to >= 1.5.0.

Thanks for your help!