# Cannot authenticate request to my app in Confluence

**URL:** <https://community.developer.atlassian.com/t/cannot-authenticate-request-to-my-app-in-confluence/48968>\
**Category:** Confluence Cloud\
**Tags:** auth, ac-spring-boot, macro\
**Created:** [June 16, 2021, 12:39pm UTC](https://community.developer.atlassian.com/t/cannot-authenticate-request-to-my-app-in-confluence/48968 "2021-06-16T12:39:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anon21029823](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@anon21029823](https://community.developer.atlassian.com/u/anon21029823)\
**Post date:** [June 16, 2021, 1:13pm UTC](https://community.developer.atlassian.com/t/cannot-authenticate-request-to-my-app-in-confluence/48968/2 "2021-06-16T13:13:39Z")

</div>

Hi @ajdionisio,

As the example is a bit outdated I suspect you are running into the recent changes described in [this topic](https://community.developer.atlassian.com/t/action-required-atlassian-connect-vulnerability-allows-bypass-of-app-qsh-verification-via-context-jwts/47072). There’s a few steps you’ll need to take in order to get it working:

- Set `<atlassian-connect-spring-boot.version>2.1.0</atlassian-connect-spring-boot.version>` to `2.1.5` or later in the `pom.xml`
- Add the `@ContextJwt` annotation to the endpoint in the `DataController`
- Add the following to your `atlassian-connect.json` (might actually not be required anymore):

```auto
  "apiMigrations": {
     "context-qsh": true
  }

```

* * *

**EDIT:** Sorry, I hadn’t looked at the JavaScript code in the repository and was blindly assuming it was using `AP.context.getToken` which it actually does not. To make what I wrote above work you’ll also need to adjust the JS in `iframe.html`:

```auto
$(document).ready(function() {
	$('#hello').click(function() {
		AP.context.getToken().then(function(token) {
			$.ajax({
				url: 'data',
				beforeSend: function(request) {
					request.setRequestHeader('Authorization', 'JWT ' + token);
				}
			}).done(function(data) {
				alert(JSON.stringify(data, null, '\t'));
			});
		});
	});
});

```

To be honest, I’m not 100% sure why it doesn’t work with the token that’s generated on the backend. But it might still be related to the context QSH changes.

* * *

After doing all of that, and re-installing your app into your instance, I think it should work. Hope this helps!

Cheers,  
Sven

---

_[View the full topic](https://community.developer.atlassian.com/t/cannot-authenticate-request-to-my-app-in-confluence/48968)._
