AppMachine Help Center

How can we help you?

Follow

Setup Basic Authentication for your Web Service

Many web services use some kind of authentication method to secure access to the web service. There are a lot of authentication types available, one of which is Basic Authentication. In this How-To we will guide you through the process of setting up Basic Authentication for your Web Service. 

Prerequisites

  • A web service that requires Basic Authentication;

How To

  1. Go to http://design.appmachine.com and login;
  2. Select an existing app or create a new app;
  3. Click the "Add block" button;
    Schermafbeelding_2014-04-29_om_10.15.01.png
  4. Select the "Pro" tab;
    Schermafbeelding_2014-04-29_om_10.16.36.png
  5. Select the "Web Service" block and click "Add Block";
    Schermafbeelding_2014-04-29_om_10.17.45.png
  6. Click "Custom Web Service";
  7. Enter the URL of your Web Service;
    Schermafbeelding_2014-04-29_om_10.18.55.png
  8. Now you need to specify the Basic Authentication. AppMachine uses (so called) Authorization Providers to specify any type of authentication that should be used during a Web Service call. So to setup Basic Authentication we need to create a Basic Authentication Authorization Provider. To do so, click the "+" button next to the Authorization provider field.
    Schermafbeelding_2014-04-29_om_10.21.22.png
  9. A wizard will open. This wizard will allow you to create a new Authorization Provider. First you will need to switch the Type to Basic;
    Schermafbeelding_2014-04-29_om_11.57.30.png
  10. You will see that the number of fields you will have to fill out will be reduced to just Three;
    Schermafbeelding_2014-04-29_om_11.58.39.png
  11. First we will give the Authorization Provider a recognizable name;
    Schermafbeelding_2014-04-29_om_12.00.34.png
  12. Next, enter the Username and Password;
    Schermafbeelding_2014-04-29_om_12.01.03.png
  13. By enabling the option "Use my credentials in the app" the Web Service will always use the username and password you provided. Otherwise the user will be prompted to enter their username and password.
    Schermafbeelding_2014-04-29_om_12.32.12.png
  14. Click "Finish";
  15. Select the Authorization Provider you've just created;
    Schermafbeelding_2014-04-29_om_12.33.43.png
  16. Click "Go";
  17. We will perform a test call using the specified credentials, and when successful you can finish the Web Service integration;

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Remco Boerma

    Thanks, is the user capable of storing the username and password?

  • Avatar
    Matthijs Koopman

    Yes, if you disable the option "Use my credentials in the app" the app will prompt the user to enter their username and password. Those will be stored locally and will be used to access your REST Service. The moment your service starts returning HTTP Error 401 - Unauthorized we will discard the credentials and prompt the user to enter their credentials again.

    Please note, this feature is not yet available, but will be available in the next update, probably this week.

  • Avatar
    Khoi Nguyen

    this method does not work with username for parse (which is email) and password. I get "an error occurred while executing the web service"

  • Avatar
    Werner Bisschoff

    Khoi, I've gotten past that issue... You have to Decode the E-mail on the Server side, because the URL query is being Encoded when sending.

  • Avatar
    Ben Goosse

    Dear Matthijs,

    I've tried your solution. But it doesn't seem to work. The credentials do not get discarded and I 'm not prompted to enter my credentials again.

    Was this implemented?