Skip to content

Auth:AuthCode

Authenticates with the server, providing client identity and an authorisation grant sourced externally.

This is primarily for internal and specialised clients. Typical API users should use the OAuth flow documented in the Authentication section of this document.

Controller: Auth
Topic: AuthCode
Action: Publish
Permissions: None

NameTypeExpectDescription
ProviderStringAlwaysThe authentication provider to login with
ClientIDStringAlwaysThe identifier of the client software
ClientSecretStringOptionalThe password for this client software, if any. Used for secure clients.
AuthGrantStringAlwaysAn authorisation grant understood by the given Provider
ScopeArrayOptionalAn array of strings identifying the desired access rights. If omitted, uses the maximum available for the user. See Appendix A: Access Rights for more information.
NameTypeExpectDescription
ResultStringAlwaysResult code. One of the following:
Success: Authentication accepted
Reject: Authentication rejected.
AccessTokenStringOptionalIf successful and permitted for the user, provides the Base-64-encoded access token that can be saved and given to AuthToken to restore this connection in the future
DisplayNameStringOptionalIf successful and available, provides a friendly name for the authenticated user
UserIDStringOptionalIf successful, provides an internal name for the authenticated user
ExpiryDateDateTimeOptionalIf successful and this authentication will expire, provides the date and time when this will occur
ScopeArrayOptionalIf successful, provides an array of strings describing the accepted security scopes

See Data Types for DateTime formatting.

var authGrant = authWithExternalService();
websocket.send(JSON.stringify(
{
Controller:"Auth",
Topic:"AuthCode",
TransactionID:1,
Data:
{
Provider: "Paritech",
ClientID: "TriOptimum",
AuthGrant: "authGrant",
Scope: ["Paritech.Zenith"]
}
}));

Sample Response:

{
"Controller":"Auth",
"Topic":"Identify",
"TransactionID":1,
"Data":
{
"Result":"Success",
"Scope":["Paritech.Zenith.Market", "Paritech.Zenith.Trading"]
}
}