API reference

Subscribe to Data

Authorization Process

1. Initiation

REflex users initiate a pub/sub relationship through the REflex AppStore

2. Authorization

REflex AppStore publishes AuthorizeAction to the User's Pod Inbox.

https://schema.org/AuthorizeAction

POST /inbox/ HTTP/1.1
Host: user.example.com
Content-Type: application/json

{
  "type": "AuthorizeAction",
  "object": "https://app.example.org/profile/card#me",
  "context": {
    "scope": [
      "profile:read"
    ]
  }
}

3. Subscription

After performing any required provisioning, the User's Pod publishes SubscribeAction with actionStatus = PotentialActionStatus to the Application's Pod Inbox with the approved scopes.

https://schema.org/SubscribeAction

POST /inbox/ HTTP/1.1
Host: app.example.com
Content-Type: application/json

{
  "type": "SubscribeAction",
  "actionStatus": "PotentialActionStatus",
  "agent": "https://user.example.org/profile/card#me",
  "object": "https://app.example.org/profile/card#me",
  "context": {
    "scope": [
      "profile:read"
    ]
  }
}

4. Confirmation

The application perform and required provisioning and acknowledges the subscription by publishing a SubscribeAction with actionStatus = CompletedActionStatus to the User's Pod Inbox

POST /inbox/ HTTP/1.1
Host: user.example.com
Content-Type: application/json

{
  "type": "SubscribeAction",
  "actionStatus": "ActiveActionStatus",
  "agent": "https://app.example.org/profile/card#me",
  "object": "https://app.example.org/profile/card#me"
}

Deauthorization

When a user revokes your application's their inbox, your application will receive a RejectAction

https://schema.org/RejectAction

POST /inbox/ HTTP/1.1
Host: app.example.com
Content-Type: application/json

{
  "type": "RejectAction",
  "object": "https://app.example.org/profile/card#me",
  "target": "https://user.example.org/profile/card#me"
}

Diagrams on this page generated by js-sequence and the following

User->Application: 1. Intiation (WebUI)
User->Application: 2. Authorization {AuthorizeAction}
Application->User: 3. Subscription {SubscribeAction}
User->Application: 4. Confirmation {SubscribeAction}
Previous
publish