Testing Authentication

The Lockstep API provides a Ping endpoint that you can use to test your authentication code. The Ping API always returns a 200 OK result, which means that you will always get a success message and diagnostic information explaining what authentication information was received by the Lockstep API server.

This feature makes the Ping endpoint useful to debug connectivity and HTTP issues. If you are successfully able to contact the Ping endpoint, and you receive back a 200 OK response, you know that the Lockstep API is functioning and that you have a valid network connection.

If your ping API call succeeds, you will receive a response that looks like this:

{
  "loggedIn": true,
  "dependencies": { ... }
}

Validating credentials

The Ping API can help you to validate whether a user is a valid Lockstep user. Call the Ping API and check the StatusModel result for the loggedIn value. If the bearer token is valid, the flag loggedIn will be set to true, and the userName and accountName fields will be set to the name of the user that owns the bearer token.

Debugging connectivity issues

To test whether your application is able to reach the Lockstep Platform API Server, you can make a Ping() call without any authentication information. This API will always return a 200 OK response, which means that if you receive any kind of an error, there is a problem in the network between your computer and the Lockstep API server.

This can be used to identify the following types of problems:

  • Network connectivity
  • DNS problems
  • Proxy server configuration
  • Content blocking or HTTP blocking

The response format for a Ping call without authentication is the following:

{
  "loggedIn": false,
  "errorMessage": "No bearer token found in header 'Authorization'",
  "dependencies": { ... }
}

You can use the presence of the 200 OK response code to determine that you were able to successfully contact the Lockstep Platform API server. If you receive a message in a different format, please review to determine whether you are experiencing problems with your network, a proxy server, or some other system.


Did this page help you?