Stack Exchange
InvalidRegistration in firebase
I have this message service
import { Injectable } from '@angular/core';
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
import { BehaviorSubject } from 'rxjs'


@Injectable()

export class MessagingService {
  
  currentMessage = new BehaviorSubject<any>(null);
  
  constructor(private angularFireMessaging: AngularFireMessaging) {


  this.angularFireMessaging.messages.subscribe(
   
    (_messaging:any) => {  
    _messaging.onMessage = _messaging.onMessage.bind(_messaging);
    _messaging.onTokenRefresh = _messaging.onTokenRefresh.bind(_messaging);
    }
  )


}
requestPermission() {
this.angularFireMessaging.requestToken.subscribe(
(token) => {
console.log(token);
},
(err) => {
console.error('Unable to get permission to notify.', err);
}
);
}
receiveMessage() {
this.angularFireMessaging.messages.subscribe(
(payload) => {
console.log("new message received. ", payload);
this.currentMessage.next(payload);
})
}
}

followed this link

https://www.devstringx.com/firebase-cloud-messaging-push-notifications


getting invalid registration

Server key is


and to is what is get from this request token method
requestPermission() {
this.angularFireMessaging.requestToken.subscribe(
(token) => {
console.log(token);
},
(err) => {
console.error('Unable to get permission to notify.', err);
}
);
}

