Use of authentication token

Now we know how to authenticate to the WNS and how we can set the options in the settings object.

Now we need to know how to set the authentication token in the setting object.

It’s very simple, but you need to know another object, the : OAuthObject

In first way we need to create an OAuthObject and set credentials.

We have two way:


$MyAuthObject = new WindowsNotification\OAuthObject(array("token_type"=>"Bearer", "access_token" => "<mytoken>"));

Or via object methods

$MyAuthObject = new WindowsNotification\OAuthObject();

After this we can set the token in the WNSNotificationOptions object

$Options = new WindowsNotification\WNSNotificationOptions();    $Options->SetAuthorization($MyAuthObject);


Now we can use WNSNotificationOptions object and instantiate a new WindowsNotificationClass and send notifications.

Last edited May 16, 2015 at 3:19 PM by Andreabbondanza, version 5