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 need to get message token in safari
but it dont ask permission
Steps and code to reproduce issue
here is my code, it works on chrome but in safari it dont ask permission
const getToken = async () => {
if (Notification) {
const permission = await Notification.requestPermission();
if (permission === "granted") {
try {
const token = await getMessagingToken();
if (token !== firebaseToken) {
setFirebaseToken(token);
await pushToken({
variables: {
token
}
});
}
} catch (e) {
console.log(e);
}
}
}
};
The text was updated successfully, but these errors were encountered:
Hi @bangln, could you check the developer console of your Safari browser and see if there's an error message similar to "Push notification prompting can only be done from a user gesture.". If so, it means that users need to interact with your app to request permission for push notification, such as clicking a button to "subscribe" or "enable notification".
Hey @bangln. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Operating System
IOS 16.4
Environment (if applicable)
React js
Firebase SDK Version
10.14.0
Firebase SDK Product(s)
Messaging
Project Tooling
React
Detailed Problem Description
I need to get message token in safari
but it dont ask permission
Steps and code to reproduce issue
here is my code, it works on chrome but in safari it dont ask permission
const getToken = async () => {
if (Notification) {
const permission = await Notification.requestPermission();
if (permission === "granted") {
try {
const token = await getMessagingToken();
if (token !== firebaseToken) {
setFirebaseToken(token);
await pushToken({
variables: {
token
}
});
}
} catch (e) {
console.log(e);
}
}
}
};
The text was updated successfully, but these errors were encountered: