AppMachine Help Center

How can we help you?

Follow

Setup authentication using API keys

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 the use of API Keys. This article will guide you through the process of setting up authentication based on API Keys for your Web Service. 

Fields

Query
All query parameters will be appended to the url in the following format:
https://www.example.com/api/endpoint?parameter=value

Template
All template parameters will be used to replace values in the url, like:
https://www.example.com/api/endpoint/{id}
Where the parameter name will be id and the entire {id} will be replaced with the parameter value when the web service request is being executed.

Headers
All header parameters will be appended to the Request Headers that are send along with your request.

Body
All body parameters will be appended to the request body of POST, PUT and DELETE Web Service calls. The body can be formatted either as JSON or FORM-URL-ENCODED.

Prerequisites

  • A web service that requires API Key based 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;
  8. Now you need to specify the API Key based Authentication. AppMachine uses (so called) Authorization Providers to specify any type of authentication that should be used during a Web Service call. To setup an API Key based Authentication we need to create a Custom Authentication Authorization Provider. Click the "+" button next to the Authorization provider field.
    Schermafbeelding_2014-04-29_om_10.21.22.png
  9. The wizard will allow you to create a new Authorization Provider. First you will need to switch the Type to Custom;
    Schermafbeelding_2014-10-07_om_14.48.44.png
  10. Give the Authorization Provider a recognizable name;
    Schermafbeelding_2014-10-07_om_14.51.35.png
  11. Specify the parameters that we should send along with each web service using this authorization provider;
    Schermafbeelding_2014-10-07_om_14.12.00.png
  12. Click "Finish";
  13. Select the Authorization Provider you've just created;
    Schermafbeelding_2014-04-29_om_12.33.43.png
  14. Click "Go";
  15. We will perform a test call using the specified API Keys, and when successful you can finish the Web Service integration;

 

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

Comments

  • Avatar
    Eshelvesapp
    I used this method to setup the authentication that my API requires. All went well, because I have been able to create a webservice block to POST the username and password (it creates a form where the user can introduce his credentials) When that request is sent, is supposed to return a token, but I am having trouble retrieving it (neither {data:token} nor {Dataprovider:token} returns it). What approach should I take for this?