Complete the WebPros authentication flow
Changed onThis function completes the WebPros single sign-on flow for 360 Monitoring.
Call this function after the WebPros authorization server redirects the user back to the server. The function exchanges the authorization code for a token bundle and stores that bundle on the server. It does not return the access token or the refresh token. Use the 360Monitoring/webpros_auth_token function to retrieve the access token.
This function accepts its arguments as a single JSON-encoded json parameter, and it requires that parameter in the request body. The authorization code is a secret, and the server records the URL query string in its access log. The function therefore rejects a request that is not an HTTP POST, and also rejects a json parameter that appears in the query string of a POST.
The function returns data.success with a value of 1 when it stores a token. If the function fails, it returns data.success with a value of 0, a human-readable data.error message, and, for the failures that it detects before it contacts the authorization server, a machine-readable data.reason value.
Request
- Base URLhttps://whm-server.tld:2087/json-api
- AuthHTTP basic
Request body application/x-www-form-urlencoded
Example request
{
"json": "{\"code\":\"SplxlOBeZQQYbYS6WxSbIA\",\"state\":\"Xk7fQ2mR9vLpN4wCbT8yHzA1sD6gJ3eU0iO5nY7kV2q\"}"
}Response
The HTTP Request succeeded.
Example response
{
"data": {
"error": "The “code” parameter is required.",
"reason": "missing_parameter",
"success": 1,
"token_data": {
"email": "user@example.com",
"expires_in": 900
}
},
"metadata": {
"command": "webpros_auth_callback",
"namespace": "360Monitoring",
"reason": "OK",
"result": 1,
"version": 1
}
}Changes
- info
endpoint added
- info