ServerAPI:Auth commands

From FlexRule Wiki
Jump to: navigation, search

FlexRule Server Authorizer uses OAUTH protocol.

Url

http://{your server address}/oauth2/token

Check Parameters for more information on parameters' name and value.

Note pinned.png Only HTTP POST method is valid for authorization.

Parameter

  • Header
    • Content-Type: application/x-www-form-urlencoded
  • Type:
    • grant_type: password

For Application Accounts

  • client_id: [your client id account]
  • client_secret: [your client id account's secret (password)]

For User Accounts

  • username: [your user login account]
  • password: [your user logic account's secret (password)]

Result

Server will return an data that has an access_token for your session.

  1.  function (data) {
  2.      var token = data.access_token;
  3.  }

Example

Url

http://localhost:9000/oauth2/token?grant_type=password&client_id=app1&client_secret=123456

Request

Below is the HTTP request configuration:

Server-Request-Auth.png

Response

Once the request is posted, you get the below response:

Server-Response-Auth.png