Add token validation service

Created on 16 October 2019, over 5 years ago
Updated 10 May 2024, 11 months ago

Motivation

In order to use FCM you should save the device tokens in Drupal. This service provide an easy way to check that the token sent by the device is really a registered token in Firebase.

Proposed resolution

In order to validate device token you should:

// Token is generated by app. You'll have to send the token to Drupal.
$fakeToken = 'e3vUiwcvkpY:APA91bEDZzKTIkaL0e-UTwiV6EGi1m5J5PrDMxejm6-d85vdwAgd';

// Before saving this token, validate it through firbase
$tokenValidation = \Drupal::service('firebase.token_validation');

// Get TRUE if validated or FALSE if not
$result = $tokenValidation->validateDeviceToken($fakeToken);

Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇪🇸Spain jginer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024