Making Tax Digital Testing - Invalid Client ID

We are trying to test out, and get to grips with, the MTD development in Business Central (On Premise) - We are following the Microsoft online guides but whenever we try to "request Authorisation code" on Oauth2 setup (using the test api for the HMRC sandbox we get the error {"error":"invalid_request","error_description":"client_id is invalid"}

If we point the service to the live endpoint the client ID is correct - the issue is that we want to test it with the test-api endpoint but we cannot.

The Client ID and secret are the ones published by Microsoft on Partnersource but there doesn't seem to be a different client id for the live/test environments

Any suggestions would be appreciated!


  • patricksoutarpatricksoutar Member Posts: 4
    I believe in order to use any of the testing features you need to register at

    Then you will have to create your own 'application', which is a way to have your own test environment that you can select available endpoints for, including VAT (MTD).

    Once you have created this 'application', you will then have a unique client ID and secret which is what I have used to put in to my test environment which happens to be NAV (not BC).

    From there you can then request a token, however before you do this you should use the Support API to generate a test user, which will generate an ID/Password so you can log in when requesting the token in order to grant authorisation, and it will give you, providing you select Organisation (not individual) a VAT number along with other details you may need.
  • patricksoutarpatricksoutar Member Posts: 4
    I have an update on this. Creating the test users from the links does not work as it is a 'basic' test user. You must use the API to generate your test user.

    This can easily be done using the application Postman if you are not familiar with generating on-the-fly api calls.

    API Reference:
  • le_timonle_timon Member Posts: 1

    Wanna hook in here too. Thanks for the API Reference! In our NAV 2015 CU53 test environment everything worked well so far.
    We rolled out the CU update for our customer successfully. After setting up and using the client id and client secret provided by microsoft in the partner source here:
    we tried to input the authorisation code provided from our customer during a remote-session but now getting an error code:

    Write Authorisation failed.Reason: Http error 400 (BadRequest)code is invalid

    So two possibilties come to my mind:

    1) The live environment is not yet "live" and is refusing the code?!
    2) The client id / secret is espescially for Business Central 365 and so not applicable for NAV 2015 - 2018

    If 2) is right, can someone tell me where to find the right credentials?!

    Any help would be very appreciated and thanks in advance!

Sign In or Register to comment.