GetTokenOptions interface
Stay organized with collections
Save and categorize content based on your preferences.
Options for getToken().
Signature:
export interface GetTokenOptions
Properties
Property |
Type |
Description |
serviceWorkerRegistration |
ServiceWorkerRegistration |
The service worker registration for receiving push messaging. If the registration is not provided explicitly, you need to have a firebase-messaging-sw.js at your root location. See Access the registration token for more details. |
vapidKey |
string |
The public server key provided to push services. The key is used to authenticate push subscribers to receive push messages only from sending servers that hold the corresponding private key. If it is not provided, a default VAPID key is used. Note that some push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended to generate and import a VAPID key for your project with Configure Web Credentials with FCM. See The Web Push Protocol for details on web push services. |
GetTokenOptions.serviceWorkerRegistration
The service worker registration for receiving push messaging. If the registration is not provided explicitly, you need to have a firebase-messaging-sw.js
at your root location. See Access the registration token for more details.
Signature:
serviceWorkerRegistration?: ServiceWorkerRegistration;
GetTokenOptions.vapidKey
The public server key provided to push services. The key is used to authenticate push subscribers to receive push messages only from sending servers that hold the corresponding private key. If it is not provided, a default VAPID key is used. Note that some push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended to generate and import a VAPID key for your project with Configure Web Credentials with FCM. See The Web Push Protocol for details on web push services.
Signature:
vapidKey?: string;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-19 UTC.
[null,null,["Last updated 2024-01-19 UTC."],[],[],null,["# GetTokenOptions interface\n\nOptions for [getToken()](./messaging_.md#gettoken_b538f38).\n\n**Signature:** \n\n export interface GetTokenOptions \n\nProperties\n----------\n\n| Property | Type | Description |\n|-------------------------------------------------------------------------------------------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [serviceWorkerRegistration](./messaging_.gettokenoptions.md#gettokenoptionsserviceworkerregistration) | ServiceWorkerRegistration | The service worker registration for receiving push messaging. If the registration is not provided explicitly, you need to have a `firebase-messaging-sw.js` at your root location. See [Access the registration token](https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token) for more details. |\n| [vapidKey](./messaging_.gettokenoptions.md#gettokenoptionsvapidkey) | string | The public server key provided to push services. The key is used to authenticate push subscribers to receive push messages only from sending servers that hold the corresponding private key. If it is not provided, a default VAPID key is used. Note that some push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended to generate and import a VAPID key for your project with [Configure Web Credentials with FCM](https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app). See [The Web Push Protocol](https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol) for details on web push services. |\n\nGetTokenOptions.serviceWorkerRegistration\n-----------------------------------------\n\nThe service worker registration for receiving push messaging. If the registration is not provided explicitly, you need to have a `firebase-messaging-sw.js` at your root location. See [Access the registration token](https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token) for more details.\n\n**Signature:** \n\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n\nGetTokenOptions.vapidKey\n------------------------\n\nThe public server key provided to push services. The key is used to authenticate push subscribers to receive push messages only from sending servers that hold the corresponding private key. If it is not provided, a default VAPID key is used. Note that some push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended to generate and import a VAPID key for your project with [Configure Web Credentials with FCM](https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app). See [The Web Push Protocol](https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol) for details on web push services.\n\n**Signature:** \n\n vapidKey?: string;"]]