You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to Logging out app user by calling OneSignal.removeExternalUserId(); but my user is still taking notifications
and when i debugged this App is still having same user id .
image is attached the message i'm receiving .Please guide me what i'm doing wrong?
My Code is
$(document).ready(function() {
// console.log('Test', typeof OneSignal , typeof OneSignal)
// if(typeof window.OneSignal === "undefined"){
// }
var OneSignal = window.OneSignal || [];
OneSignal.push(["init", {
appId: ONESIGNAL_APP_ID,
subdomainName: "",
autoRegister: true,
promptOptions: {
actionMessage: "We'd like to show you notifications for the latest orders",
acceptButtonText: "ALLOW",
cancelButtonText: "NO THANKS"
}
}]);
// var OneSignal = OneSignal || [];
OneSignal.push(function(){
console.log("User id to save in OS: "+USER_ID)
OneSignal.setExternalUserId(USER_ID);
OneSignal.on('subscriptionChange', function(isSubscibed){
console.log("The user's subscription state is now", isSubscibed);
/*OneSignal.sendTag("user_id","4444", function(tagsSent) {
console.log("Tags have finished sending!");
});*/
});
var isPushSupported = OneSignal.isPushNotificationsSupported();
if(isPushSupported)
{
OneSignal.getUserId( function(userId) {
/* $.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type:'POST',
url: '/user/push',
dataType: 'json',
data: { userId: userId},
success:function(response){
if(response.status){
alert(response.userId)
}
}, error: function (response) {
//alert(response.responseJSON.errMsg);
}
})*/
console.log("userId", userId);
});
OneSignal.isPushNotificationsEnabled().then(function(isEnabled)
{
if(isEnabled)
{
//console.log(OneSignal)
console.log("Push nofitications are enabled");
}else {
OneSignal.showHttpPrompt();
console.log("Push notifications are not enabled yet.");
}
});
}else{
console.log("Push notifications are not supported.");
}
});
//logout if user_id is empty
if (USER_ID == ""){
OneSignal.removeExternalUserId();
}
});
The text was updated successfully, but these errors were encountered:
Hi this issue is still on. OneSignal.removeExternalUserId() rejects with changing external_user_id on players require passing external_user_id_auth_hash
As I dig into the source and found OneSignal.privateSetExternalUserId() (called by removeExternalUserId) requires 2 argument externalUserId, authHash, but removeExternalUserId doesn't provide auth-hash.
i tested calling await OneSignal.privateSetExternalUserId(undefined, 'auth-hash'); directly and it work as intended.
I'm trying to Logging out app user by calling OneSignal.removeExternalUserId(); but my user is still taking notifications
![image](https://user-images.githubusercontent.com/36416671/101911394-1f608900-3be2-11eb-8a39-189bacfdec90.png)
and when i debugged this App is still having same user id .
image is attached the message i'm receiving .Please guide me what i'm doing wrong?
My Code is
The text was updated successfully, but these errors were encountered: