User identification
In order to get the notifications from Indigitall's Inbox, the user must identify himself. First you have to initialize the SDK of Indigitall so that it generates our identifier (deviceId) and be able to associate it to the custom ID that you associate to the device.
To perform the registration tasks, these two methods are used:
//User ID
window.plugins.indigitall.logIn("YOUR_ID",(device) => {
//DO SOMETHING
}, (error)=>{
//LOG ERROR
});
window.plugins.indigitall.logOut(device => {
//DO SOMETHING
}, (error)=>{
//LOG ERROR
});
Generate authentication token
In this section you will see how to generate a validation token for an application that has configured authentication with webhook. To generate this token, you need to add the JSON with the configuration.
The token has a predetermined expiration date, once it has expired in our system, a listener event of type InboxAuthListener will be fired indicating said expiration and will have to return the configuration JSON. To collect the listener, you have to implement it in the corresponding class, and override the following method:
public class MainActivity extends CordovaActivity implements InboxAuthListener{
@Override
public JSONObject getAuthConfig() {
return MY_JSON;
}
The token has a predetermined expiration date, once it has expired in our system, an event of type 'Protocol' will be launched, which will indicate said expiration and will have to return the configuration JSON. To collect the event, you have to implement it in the corresponding class, and override the following method:
class YOURCLASS: GetAuthConfig
func getAuthConfig() -> [AnyHashable : Any] {
...
return YOUR_JSON
}
@interface MainInboxProtocol: NSObject<GetAuthConfig>
@end
@implementation MainInboxProtocol
- (NSDictionary *)getAuthConfig{
return YOUR_JSON;
}
@end