Verizon Personal Cloud Storage JavaScript SDK allows you to develop apps which can access Verizon Personal Cloud Storage user content (subject to the user's prior approva). It provides authentication and authorization for the apps.
Before you can start coding, you will need to:
Key, Secret, and Callback URL are established during registration. If you have not yet registered, follow the steps on the Getting Credentials to Use the Personal Cloud Storage APIs page in the API Developer Guide to register.
Follow these steps to add the Verizon Personal Cloud Storage JavaScript SDK to your project:
To add the SDK to your project, include the cloud.js file in the <head>
element of your webpage as follows:
Code Sample
<script src=“{{path to downloaded cloud file}}/thingspace.cloud.min.js"></script>
Initialize the SDK.
Code Sample
thingspace.cloud.init({
clientKey : "{{Key provided by Key Management}}",
clientSecret : "{{Secret provided by Key Management}}",
callbackUrl : "{{Callback URL you provided to Key Management when you registered your app}}",
/* optional callback for when the SDK can begin making calls */
postInitialize : function(initted) {
if(!initted) {
console.log("could not initialize the API");
}
}
/* optional callback for when a user has attempted to complete the authorization flow */
postAuthenticated: function(success, errorCode) {
},
/* optional callback for when an authorization token expires or is revoked */
onAuthInvalidated: function() {
}
});
Use postInitialize
function passed in the init
method, or by wrapping your code in a jqeury-like ready handler, as shown in this example:
Code Sample
thingspace.cloud.ready(function() {
// api is initialized
});
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.