Open RaoJackie123 opened 5 days ago
This error is also been seen due to the ctx.secrets.backstageToken
change:
https://github.com/backstage/backstage/issues/25096
in addition, I have my proxy config set as following:
proxy:
endpoints:
'/gitlab':
target: 'https://gitlab.com/api/v4'
headers:
content-type: 'application/json'
Authorization: 'Bearer {token}'
changeOrigin: true
# Change to "false" in case of using self hosted instance with a self-signed certificate
secure: true
and get the following error:
401 Response body: {"error":{"name":"AuthenticationError","message":"Illegal token","stack":"AuthenticationError: Illegal token\n
does the plugin try to override the authentication token even when if the Authentication
hearder has already been set in proxy config?
So, I think this should be a bug for the action, I will try to create a PR on this.
http:backstage:request action will throw out invalid plugin token error when call custom plugin
Expected Behavior
When we use the http:backstage:request action, we would like to call an internal API from our custom plugin, it should work as our frontend plugin can call it without any issue
Current Behavior
However, when we call the internal API, it throws out the invalid plugin token error like below:![image](https://github.com/RoadieHQ/roadie-backstage-plugins/assets/173973099/f4b8eb37-d0dd-4a49-9f38-1579385a77af)
The issue happened after our backstage upgrade to 1.28+. Currently we can only use the action to call the internal api from backstage catalog plugin without any issue.
Steps to Reproduce
Possible Solution
We did some investigation for the issue, and found some reason:
That's why we only be able to call the catalog plugin api with this action. I think we can update our token logic to get the target plugin token with the standard method: const { token } = await auth.getPluginRequestToken({ onBehalfOf: credentials, targetPluginId: '', // e.g. 'catalog'
});
Context
Your Environment