hmrc / vat-api

Apache License 2.0
67 stars 17 forks source link

CLIENT_OR_AGENT_NOT_AUTHORISED when requesting obligations as an agent #875

Closed Bittarman closed 2 years ago

Bittarman commented 3 years ago

CLIENT_OR_AGENT_NOT_AUTHORISED when requesting obligations as an agent

When using the agent authorisation API, we are able to successfully invite an organisation and an individual created with the CreateUser api.

However, when we then try to use the agents credentials with the MTD-VAT api, we receive a CLIENT_OR_AGENT_NOT_AUTHORISED error.

We have checked using the agent authorisation api that the relationship exists before attempting to fetch the vat obligations of the organisation

We are able to use the MTD-VAT api if we use a token from one of those accounts, just not with the agent account token once it has been accepted for the organisation or individual.

The VAT number for an organisation used for this is 237943241 The ARN for an agent we have used for this is TARN0975056

We have only used the sandbox API for this

hmrc-api-team commented 3 years ago

Hi Bittarman,

Unfortunately agent users aren't currently not working in the Sandbox environment. We will raise this with the relevant team.

Kind regards,

MTD API Team

steveetm commented 3 years ago

I don't know if it is related, but for a while we can successfully authenticate in sandbox environment with test users, getting access token properly, but after that every obligation request and even fraud prevention header test api requests return cloudfront error.

@hmrc-api-team can you please confirm if the sandbox env is broken right now, or it should work?

zmagyar commented 2 years ago

@hmrc-api-team is there any update on this please? We are delaying a significant release of our app at the moment as this issue stops us to test the application.

Benjamindyer commented 2 years ago

Just echoing what others have said, the Sandbox environment is dead for us at the moment.

hmrc-api-team commented 2 years ago

Hi all, apologies for the delayed response. The team responsible for creating Agent users are aware of this issue and we have been told that they will be working on a fix soon. We have done some preliminary investigation before raising the issue with them so hopefully that will expedite the process.

Since this is an issue that sits outside the code within the vat-api itself, we cannot comment on when exactly this fix will go into Sandbox however we will endeavour to keep you all updated on this Issues thread when it goes in.

Kind regards

Bittarman commented 2 years ago

Thanks for the update @hmrc-api-team

hmrc-api-team commented 2 years ago

Hi @Bittarman, @Benjamindyer, @zmagyar, @steveetm,

Please could you try requesting Obligations as an Agent again? We have been advised that the team responsible has pushed a fix in for this last night.

Kind regards

hmrc-api-team commented 2 years ago

Hi @Bittarman, @Benjamindyer, @zmagyar, @steveetm,

We have tested Agents in Sandbox ourselves and can see they are now working. If you require assistance setting up an Agent, please follow the Guide.

If you have any further questions, please leave them below. If you have followed the Guide above and still find that Agents are not working for you, please re-open this Issue with steps to reproduce.

Kind regards