Authentication and Security with the Akana API Platform API

Authentication of platform API users is managed by means of the Akana API Platform authorization cookie.

The platform API includes a powerful set of operations for completing many activities relating to app and API management. Some of these operations, which only retrieve information publicly available on the platform, do not require any sort of authentication to run them. Many operations, for example those relating to an individual user, require at least a platform login. Operations relating to adding, changing, or deleting apps, APIs, and other resources require additional authentication to verify that the individual running the operation has the authority to make the changes. Authentication is verified by means of a session cookie which is sent to the individual user at login.

In working with the platform API, you'll need to make sure you have the appropriate access rights for running the various operations. This topic provides information on authentication requirements and how to obtain the necessary credentials to run operations. It also includes information on the session cookie, including how to renew the cookie and how to end the session.

Note: Depending on platform configuration, authentication of some operations, most likely POST, PUT, and DELETE operations, might also require a special header, the the X-Csrf-Token_{fedmemberID} header. For more information, see CSRF Prevention on the Platform.

It includes:

Determining authentication requirements

The documentation for each operation includes an Authorization Roles/Permissions section that tells you the roles that are authorized to run the operation. Some examples:

Back to top

Operations you can run without login

Some operations, which retrieve general information not marked as Private (see Public and private resources below), do not require any authentication at all. Anyone can run these operations at any time using a standard HTTP browser or a general purpose REST API client such as RESTClient, Postman, or soapUI, or using an app (implemented with any technology) that is consuming the platform API.

The operations you can run without logging in are all "read" operations using the HTTP verb GET. Some examples:

  • GET /{contentpath}: Retrieves a specific content document. To retrieve content, no login is required, unless the content is marked as Private (see Public and private resources below).
  • GET /api/apis: Returns a list of APIs. Again, APIs marked as Private are not returned, but all APIs marked as Public are visible to all users in the Akana API Platform user interface, whether logged in or not, and anyone can perform this operation via the API without logging in.

Back to top

Authenticating as a logged-in user

Before running API operations that require login, you'll need to perform a one-time signup via the user interface or API. To complete the signup process, sign up using the developer portal or the Users service.

Once you've completed that process, you'll be able to use your user ID and password to log in via the API using the POST /api/login operation.

When you run the POST /api/login operation, you'll need to get the session cookie from the response and then include it in the request headers for subsequent operations. For more information, see The session cookie below. In many cases, technologies used in applications automatically remember the cookie received in the Login response and include it in subsequent requests.

You'll need to have additional roles to run certain operations; for per-operation authentication requirements, refer to the Authorization Roles/Permissions section in the documentation for each operation. For general information about roles, see Operations that require additional authorization roles / permissions below.

You'll also need to renew the session cookie after a certain period of time, or after certain events. See Renewing the cookie below.

You don't need to be logged in to run operations that require no authentication (see Operations you can run without login above).

For information about SSO login scenarios, refer to Managing SSO Login on the Platform.

Back to top

Operations that require login

Certain operations relating to an individual user, such as changing the password, can only be performed by the individual user, and require login.

Some other operations can be performed by an individual user or an Admin; for example, GET /api/users/{UserID}/board, which returns a list of Board items for a specific user.

Some more examples of user-related operations that require login:

Back to top

Public and private resources

Key resources on the platform—APIs, apps, and groups—can be designated as Public or Private (Limited). Public resources are broadly available and visible; Private resources are available, and visible, only to users who have been invited to have visibility of the resource and who have accepted the invitation.

The user interface uses the terms Public and Private, but the API uses the term Limited, in place of Private, to indicate limited visibility.

The visibility setting of a resource affects the results of many API operations even when the operation itself doesn't require login. For example, a user who is not logged in can run the GET /api/apis operation, and receive a list of APIs in the response; but APIs marked as Private are not returned. A user who has access to the private APIs can run the same operation and get a broader set of results.

Back to top

Operations that require additional authorization roles / permissions

All operations relating to adding, changing, or deleting apps, APIs, and other resources require additional authentication to verify that the individual running the operation has the authority to do so.

In general, operations relating to a specific app can be run by an app team member, a Business Admin, or a Site Admin; operations relating to an API can be run by an API Admin, Business Admin, or Site Admin.

For more information on the various roles and the permissions that generally go along with them, refer to Authorization Roles on the Platform.

Back to top

The session cookie

When you run the POST /api/login operation, the response includes a session cookie which you'll need to make sure is included in the request headers for subsequent operations. If you're using a browser-based client, the cookie is probably sent automatically, but if not, you must explicitly include it.

For more information and examples, refer to Cookies in the Akana API Platform.

You'll also need to renew the cookie, after 30 minutes or after certain events. See Renewing the cookie below.

Back to top

Renewing the cookie

The session cookie includes certain pieces of information that might change during the session as a result of the user's actions. For example, it includes information about the user's APIs, apps, and groups. If this information changes, the cookie must be renewed, and the new cookie must be used from that point onwards.

Once the user is logged in, if an operation is invoked that requires this cookie to be updated, the response to the operation includes the updated cookie in a Set-Cookie response header. The client can use the new cookie or, alternatively, the client can renew the cookie using the POST /api/login/renewToken operation.

For example, let's say that you want to use the API to accept an invitation to a group and then invite other members to that group. The operation for accepting a group invitation, POST /api/groups/requests/{MembershipRequestID}/actions, includes an updated cookie in a Set-Cookie response header, and also includes the following response header:

Atmo-Renew-Token: renew

This indicates that you must use the new cookie from the response in additional operations.

You can renew the cookie manually at any time by using the POST /api/login/renewToken operation.

Back to top

Ending the session

When your session is complete, remember to log out using the POST /api/login/logout operation.

Note: If the platform you are using has federation support, remember to invoke logout on all federation members.

If logout is not invoked, if the renew token is not invoked, the session expires when the token expires.

Back to top

Related Topics