Regading OAuth: Sorry, there is a problem with the service

Subject: Please route to API/Identity OAuth team: CH OAuth authorisation failing with generic service error

Hello Companies House team,

Please could you route this to the API / Identity OAuth support team.

We are integrating Companies House OAuth in our software and consistently hit a failure at the authorisation step.

Issue details:

Observed behaviour:

  • User is redirected to identity service successfully.

  • Then lands on generic CH error page:
    Sorry, there is a problem with the service

  • No OAuth callback error is returned to our app (error/error_description not received).

Please can you confirm:

  1. Whether this client ID is fully enabled/active for OAuth in sandbox.

  2. Whether the redirect URI above is correctly registered for this client.

  3. Whether the requested scope is valid for this client.

  4. If backend logs show the exact rejection reason for the attempted authorise request.

We can provide exact timestamps and full request query for correlation.

I’ve got the same issue. I had all of this working 9-12 months ago and I’ve come back to it, having had my applications removed. I’ve created new apps and with the same code, the authorise secures a redirect url, but that simply shows a Page Not Found error.

So, what’s changed? Can I provide my client and timestamp details to verify what the back-end issue is?

in our case it turned out not to be a mysterious backend outage.

What changed for us was the identity endpoint and callback handling.

We had rebuilt our app using sandbox, but were still sending users to the live authorise host:

https://identity.company-information.service.gov.uk/oauth2/authorise

For sandbox, we had to switch to:

https://identity-sandbox.company-information.service.gov.uk/oauth2/authorise

And the token endpoint likewise had to be the sandbox one:

https://identity-sandbox.company-information.service.gov.uk/oauth2/token

Our redirect URI also had to match exactly, character for character, with what was registered.

The other issue on our side was callback handling. After CH redirected back to us, our app was rejecting the callback because of CSRF/session assumptions on a cross-site OAuth return. We fixed that by allowing the GET callback through and validating with the OAuth state nonce instead.

So the practical checks I’d suggest are:

  • Confirm you are using the sandbox identity host for both authorise and token if this is a sandbox app.

  • Confirm the redirect URI is an exact match to the one registered.

  • Confirm the requested scope is valid for the app.

  • Log the full generated authorise URL and the raw callback query string.

  • Check whether your own app is blocking the callback before token exchange.

In our case, once we corrected the sandbox endpoints and fixed callback validation, the flow started working again.

If you want to ask CH to check logs, I’d definitely send them your client ID, exact UTC timestamp, full authorise URL parameters excluding secrets, and the exact redirect URI used

How did you create a sandbox login?

Companies House dev el oper hub..

Could you please be a little bit more specific?

Just do this:

  1. Go to the Companies House Dev Hub:

  2. Sign in using a normal Companies House account (or create one if you don’t have it).

  3. Create an application → you’ll get:

    • API key (for REST API)

    • Option to configure OAuth (if needed)

  4. For testing (sandbox):

    • Use the test company number: 00000000

    • Use the Companies House sandbox endpoints / test services

    • For XML Gateway, set GatewayTest=1

  5. If using OAuth:

    • Add your redirect URI

    • Use the sandbox OAuth endpoints (not live)

When testing the Auth Flow, how do you then login when your redirected to Companies house though as the companies house dev hub login credentials don’t work.

Sorry responding here is tedious… i keep getting stopped for using words… apologies, i would like to help you but have to edit every line because i cannot use some word or another…