/Account/QuickLogin

Allows the client to authenticate itself with the API using a Quick-Login. performed in the current HTTP Session. This method is an alternative to the Login and WwwLogin resources.

Note: To be able to access the current session, cookies must be enabled.

Note 2: Community Login is demonstrated in the link above, as it uses Quick-Login in session mode. API documentation for Quick-Login can be found here: QuickLogin API Documentation. You need to have the Community Package installed for the Community Login to be available.

Note 3: It is assumed the Agent API account resides on the same broker. For a federated version, where you will use Agent API on a remote broker, you must use Quick Login in session mode, and provide a timeout when you call the the QuickLoginServiceId function. When the signature petition has been properly signed, the signature event will contain an Agent API token that you can use to access the account on the remote broker. You do not need to login to use the token, but you will need to refresh the token as you would any other token.

If authentication succeeds, a JSON Web Token (or JWT) is returned to the client. This token can be used as a Bearer token in subsequent calls to the API. It needs to be refreshed before it expires.

JSON

Request
{
	"seconds":Required(Int(0 < PSeconds <= 3600))
}
Response (if successful)
{
	"jwt":Required(Str(PJwt)),
	"userName":Required(Str(PUserName)),
	"expires":Required(DateTime(PExpires))
}

XML

Request
<QuickLogin xmlns="https://waher.se/Schema/BrokerAgent.xsd"
            seconds=(Required(Int(0 < PSeconds <= 3600))) />
Response (if successful)
<LoggedIn xmlns="https://waher.se/Schema/BrokerAgent.xsd"
	jwt=(Required(Str(PJwt)))
	userName=(Required(Str(PUserName)))
	expires=(Required(DateTime(PExpires))) />

Input Parameters

Parameter Description
PSeconds Requested number of seconds before the JWT token that will be issued expires.

Response Parameters

Parameter Description
PJwt A token representing the login to the account. This token is seant as a Bearer token in requests requiring authentication.
PUserName The user name of the account used for the Quick-Login.
PExpires When the JWT token expires. The token needs to be renewed before this token expires, if the client wishes to maintain the connection. After the token expires, the client needs to login again.

Javascript Library

Use the following asynchronous method in the Javascript Library, to call this resource.

var Response = await AgentAPI.Account.QuickLogin(Seconds);

Note: If login to the account is successful, the API library will maintain the resulting token, and make sure to refresh it regularly.

Test


Request Payload:

   

Response Payload: