Most API calls require an authenticated user. The APIs do not use any special user profiles. Each API can be called on behalf of any existing user using their username and password.
There are two methods to authenticate with the API:
-
Token-based authentication
-
OAuth 2.0 authentication
Token-based Authentication
Before calling any API that requires an authenticated user, call the auth/login API to obtain an authentication token. The token is valid for 24 hours and can be used for all subsequent calls, but it will expire if the user logs out via the UI. Do not create a new token for every call.
Members of multiple TMS organizations have the same username and password for multiple accounts. If multiple accounts are used, the userUid
must be added to the request body to specify which organization the user wants to log in to. If not specified, the user is logged in to the default account associated with the given username and password.
In subsequent API calls, the obtained token is used in the Authorization
header. The header value field is introduced with ApiToken
followed by a space and the token itself.
If a user logs out from the UI, the API token will no longer be valid.
If a profile is located in the US DataCenter, add us. before cloud.memsource.com, for example https://us.cloud.memsource.com/web/api2/v3/auth/login.
Example:
OAuth 2.0 Authentication
Use OAuth 2.0 in applications instead of sending tokens with each call. Phrase TMS supports a standard OAuth 2.0 authorization code grant type.
To establish the OAuth 2.0 connection, follow these steps:
-
From the Settings page, scroll down to the Registered OAuth Apps.
section and click onThe
page opens. -
Click New.
The
page opens. -
Provide a
, (Callback) and an optional . -
Click Save.
The
page opens with the new connection in the list and an associated .The ID is used in the application that connects to Phrase to establish the connection. It is stored in the database and is used to pair requests with the proper requester.
-
Use these URLs with the generated Client ID for authorization:
-
Auth URL
https://cloud.memsource.com/web/oauth/authorize
-
Token URL
https://cloud.memsource.com/web/oauth/token
If a profile is located in the US DataCenter, add us. before cloud.memsource.com, for example https://us.cloud.memsource.com/web/oauth/authorize
-
-
When authorizing, use the Administrator profile to log in and click Allow.
The application is now linked and the authentication API call will not be required.
Once the OAuth 2.0 connection is established, a Bearer token is generated for use in the application.
Example usage of Bearer token: