I am very new to web development. I have downloaded the CloudKit JS & adding in index.html in script tag. And I made sure it loads before my react-redux bundle JS.
<script src="/cloudkit.js"></script>
<script src="/bundle.js"></script>
I have made single class component & I am running authentication on component did mount as follows.
componentWillMount() {
CloudKit.configure({
containers: [{
containerIdentifier: '<container ID>',
apiToken: '<secret api token>',
environment: 'development'
}]
});
var container = CloudKit.getDefaultContainer();
container.setUpAuth().then(function(userInfo) {
if(userInfo) {
console.log(userInfo);
} else {
console.log('need to login');
}
});
}
Then I get following error How do I authenticate in React with CloudKit JS?