0
이 내 사이트가로드 될 때 부르는 :사용자가 iCloud 계정으로 성공적으로 인증 된 후에도 세션에 로그인하는 방법은 무엇입니까?
(function($){})(window.jQuery);
$(document).ready(function() {
window.addEventListener('cloudkitloaded', function() {
CloudKit.configure({
containers: [{
containerIdentifier: 'iCloud.pl.blueworld.fieldservice',
apiToken: 'fc363369412ad6c99020e7e0ed3e2be121008e34534cff7debe1f4f7f829d152',
environment: 'production'
}]
});
var container = CloudKit.getDefaultContainer();
var privateDB = container.privateCloudDatabase;
this.gotoAuthenticatedState = function(userInfo) {
if(userInfo.isDiscoverable) {
//success
} else {
//failure
}
container
.whenUserSignsOut()
.then(this.gotoUnauthenticatedState);
};
this.gotoUnauthenticatedState = function(error) {
//do sth of sign out
container
.whenUserSignsIn()
.then(this.gotoAuthenticatedState)
.catch(this.gotoUnauthenticatedState);
};
container.setUpAuth().then(function(userInfo) {
if(userInfo) {
this.gotoAuthenticatedState(userInfo);
} else {
this.gotoUnauthenticatedState();
}
});
});
});
을 내가 성공을 로그인 할 때, 올바른 버튼이 나타납니다
하지만 매번 내가 페이지이 버튼을 새로 고칠 때 변경 :
sessi을 유지하기 위해해야 할 일 사용자가 수동으로 로그 아웃 할 때까지 레코드를 불러올 수 있습니까?
현재 세션 (사용자가 이미 인증 된 사용자)이 있는지 확인하고 사용하는 방법은 무엇입니까?