web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

BC on Cloud Web services :: Unauthorized

(0) ShareShare
ReportReport
Posted on by 134

Hi all,

I am tying to access a webservice which I've published on Business Central (on cloud not on premise) but can't manage to authenticate ... I am getting error 401 : Unauthorized. 

I also tried using Basic Auth (via 'Postman') and tried to use my user's Web Service Access Key as a password which I generated directly from the user card in BC.

From the effective permissions, I can see that the user has valid permissions on the object published (also has permission SUPER among others). 

I am also using the web service url with the tenant id i.e. ; 

https://api.businesscentral.dynamics.com/v1.0/1e8d4a09-820e-xxxx-xxxx-xxxxxxxxxxxx/sandbox/WS/CRONUS%20NL/Codeunit/MoveData

Any ideas of what could be wrong here? 

Thanks in advance!

Categories:
I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Y_NAV_1716,

    Normally all webservices can be accessed by using the Business Central username and password.

    The username is on the user card (usually a first name only or first+last name, not an email address).

    The password is that the password that the user is using to access their Business Central environment.

    The web service access key you are mentioning is only neccessary in order to access web services with the user.

    There needs to be an active web service access key on the user card but it is not used in any other way.

    Instead use the B.C. username and password and normally you should be able to access the web service with that credentials.

    Kind regards,

    Floris

  • Y_NAV_1716 Profile Picture
    134 on at

    Hi Floris, thanks for your prompt reply. I had already tried to use the credentials I use to access BC but got the same error unfortunately

  • Suggested answer
    I Gusti Made Ari Profile Picture
    3,608 on at

    You can refer on below link :

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-develop-connect-apps#exploring-the-apis-with-postman-and-basic-authentication

    you can check also whether your URL is correct by check the url in "Web Services" page.

    for basic authentication , please ensure your username is without domain name.

  • betea coop Profile Picture
    16 on at

    Hi,

    Did you finally manage to run web service in Business Central Cloud? I have exactly the same problem as you. Unable to conect web service, in spite of using Web Service Access Key.

    Thanks

  • Suggested answer
    jdecottignies Profile Picture
    217 on at

    Hi,

    To test webservice call in BC I use basic authentication in postman

    As username: my BC username (found in my user card)

    As password: the webservice access key.

    Also, to copy the webservice access key, do not select character in field. Just click in the field then do CTRL + C. You will see something like a toast notification saying you correctly copied the field value.

    I precise that because it happened to me I didn't copy all the value of the field and that's why I receive a 401 response.

    With your username and this password you must be able to call BC Webservices.

  • BC developer Profile Picture
    10 on at

    Facing the same issue. Please let me know if any of you managed to figure out the issue.

    Thanks,

  • Priyanka05021986 Profile Picture
    105 on at

    Hi All,

    I am also facing the same issue even tried OData and web service not worked for me. please help

  • Suggested answer
    Synergy-IT Profile Picture
    25 on at

    I copied by following your way, now web service is accessible. I was doing double click on field and then Ctrl+C and it was also not showing toast notification as in your method and was missing "=" from web service key.

    Thanks a lot  jdecottignies :)

  • Muhammad Arif Maseed Profile Picture
    783 on at

    Basic Auth is depreciated on SaaS so you should know how to use OAuth to access Business Central SaaS APIs. Check the video in which I have guided step by step to use OAuth..

    www.youtube.com/watch

  • BG@Dynamics Profile Picture
    60 on at

    Nice video!  Is this process, for Oauth, the same for on-premise installations?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans