Channel authorize
Channel Authentication
A channel is a service which is connected to Benlly platform and could be interacted with. There are many kind of channels, for example : Social services ( Facebook, Twitter, …), Storage services (Onedrive, Evernote, …), Native services (Camera Roll, Notification, …) …
Authorizing
User giving the permission allow interacting with the channel. Usable with channel that doesn’t follow OAuth framework. Execute this kind of authorizing process by making a POST request to endpoint /api/v0.9/channel/{id}/authorize.
Request Header
Request Headers
Name |
Description |
Type |
Example |
Authorization |
Access token of user. In the format ‘Bearer xxxxxxxxxxx’ |
String |
Bearer <access_token> |
X-Benlly-Request-Device |
Type of the device in use. Available options included
- ios
- android
- web
- infoboard
- windows
|
String |
android |
X-Benlly-Udid |
Unique ID for each device. Could be generated by using SDK. |
String |
7f0abbcd-fb03-4484-aaba-a0211d9c14e2 |
URL Parameters
URL Parameters
Name |
Description |
Type |
Example |
id |
ID of the channel |
Integer |
1 |
Request Parameters
Request parameters for authorizing a channel is different, depending on the property ‘auth-type’ of each channel.
Channel have property ‘auth_type’ is ‘push_notification’
Request Parameters
Name |
Description |
Type |
Example |
token |
The access token to the Notification service, acquired by client beforehand |
String |
<access_token> |
Channel have property ‘auth_type’ is not ‘push_notification’
There are no required URL parameters.
Response Format
Like parameter, response format also depend on ‘auth_type’ property of the target channel. In case of successful, response will be of following format.
Channel have property ‘auth_type’ is ‘push_notification’
{
"data": {
"udid": "7f0abbcd-fb03-4484-aaba-a0211d9c14e2",
"device_token": "EAACEdEose0cBAGSMI90DUxkU7iVoWhpqTPAEneZB1tITkfUgNQbztCNFQpH2U5qEPUUKx3qYeuSVwKRrTs1JuSnrWvUi5ttn6x9ZBWDauNIzZBYHzZBqvYEqHVHB43bqrtlZCQVIyuiUZBXEmaZCavU30hcZALtd2I6zYcW7UuRbLAZDZD",
"expired_at": null,
"expired": false,
"created_at": "2016-04-01T12:30:31+09:00",
"updated_at": "2016-04-01T12:30:31+09:00"
}
}
Channel have property ‘auth_type’ is not ‘push_notification’
{
"data": {
"udid": "7f0abbcd-fb03-4484-aaba-a0211d9c14e2",
"expired_at": null,
"expired": false,
"created_at": "2016-04-01T12:30:31+09:00",
"updated_at": "2016-04-01T12:30:31+09:00"
}
}