Define a Custom Hello World JavaScript Authentication Provider

The Hello World Authentication Provider demonstrates the process of creating, installing, and using a custom JavaScript authentication provider. The HelloWorldAuthenticationProvider.js sample authentication provider contains many comments and should give you a good idea of how to implement your own.

You can use the authentication provider by calling the @authentication service. An easy way to test this is using the command line.

This authentication provider accepts a single value which must be the secret word specified in its configuration. We recommend you use this in the Demo API to get familiar with the mechanisms required. You can change the prompt and the secret word.

For more information:

How to Define a Hello World Custom JavaScript Authentication Provider

Set up to Use the Hello World Custom JavaScript Authentication Provider

    1. Download the attached files and place in a convenient directory.
    2. Install a Java runtime. For more information about supported Java versions, see Supported Platforms.
    3. From the command line, verify the Java version and functionality by issuing the following command:
      java -version
    4. Run the simple hw.js test stub by issuing the following command:
      ./hw.sh
      The auth provider is invoked locally outside of the API Server. When you are developing your own authentication provider, this provides a quick turn-around environment. The full capabilities of the server are not available.

Upload the Hello World Sample Authentication Provider

  1. Log in to API Creator and open your API.
  2. Go to the Create, API Properties, Libraries, Your Libraries tab and upload the HelloWorldAuthenticationProvider.js sample authentication provider, select the Used checkbox for the library, and save your changes.

Register the Hello World Custom JavaScript Authentication Provider

You register your Hello World custom JavaScript authentication provider by adding a new authentication provider.

For more information about how to register your custom JavaScript authentication provider, see Create Custom Authentication Providers using JavaScript.

Choose the Authentication Provider for your API Project

  1. With your API open in API Creator, go to Create, API Properties, Settings tab and select the new authentication provider from the Authentication provider field.
  2. Save your changes.

Your custom Hello World JavaScript authentication provider is defined and uploaded.