Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari dont ask permission #8596

Open
bangln opened this issue Oct 25, 2024 · 3 comments
Open

Safari dont ask permission #8596

bangln opened this issue Oct 25, 2024 · 3 comments

Comments

@bangln
Copy link

bangln commented Oct 25, 2024

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);
}
}
}
};

@bangln bangln added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Oct 25, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@looptheloop88 looptheloop88 added api: messaging and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Oct 25, 2024
@looptheloop88
Copy link

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".

You may also check this Firebase Blog on How to Enable Firebase Cloud Messaging on Safari for macOS.

@google-oss-bot
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants