UNPKG

voluptasmollitia

Version:
33 lines (20 loc) 1.18 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@firebase/messaging](./messaging.md) &gt; [getToken](./messaging.gettoken.md) ## getToken() function Subscribes the `FirebaseMessaging` instance to push notifications. Returns an Firebase Cloud Messaging registration token that can be used to send push messages to that `FirebaseMessaging` instance. If a notification permission isn't already granted, this method asks the user for permission. The returned promise rejects if the user does not allow the app to show notifications. <b>Signature:</b> ```typescript export declare function getToken(messaging: FirebaseMessaging, options?: { vapidKey?: string; swReg?: ServiceWorkerRegistration; }): Promise<string>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | messaging | [FirebaseMessaging](./messaging.firebasemessaging.md) | The <code>FirebaseMessaging</code> instance. | | options | { vapidKey?: string; swReg?: ServiceWorkerRegistration; } | | <b>Returns:</b> Promise&lt;string&gt; The promise resolves with an FCM registration token.