I am trying to write a simple B4J desktop program to manage sending Firebase notifications to the devices using my App.
Everything seems to be working on the B4A receive-end thanks to your help.
However, I am having much difficulty getting the correct FCM Registration Token. The token returned by my Google Account sign on just ain't good enough.
This seems to work just fine:
I would think that https://www.googleapis.com/auth/firebase.messaging would get me to the right place.
I have tried to mess around with this. I use it in the B4A app, but cannot find a FirebaseAuth lib that works in B4J:
https://www.b4x.com/android/forum/threads/b4x-b4xpages-firebasepush-firebaseauth.122477/#content
I have triple-sight-verified that the Server Key is correct and that the FCM API stuff is enabled in the G-Cloud. I also get a nice explanation of the requested permission from Mr. Google in a newly-opened browser.
Everything seems to be working on the B4A receive-end thanks to your help.
However, I am having much difficulty getting the correct FCM Registration Token. The token returned by my Google Account sign on just ain't good enough.
B4X:
' edited
ResponseError. Reason: , Response: {
"error": {
"code": 400,
"message": "The registration token is not a valid FCM registration token",
"status": "INVALID_ARGUMENT",
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
This seems to work just fine:
B4X:
Private Sub GoogleSignOn As ResumableSub
LogSub("GoogleSignOn")
Dim dirToken As String = File.DirData("GoogleAuth")
Dim Scope As String = "https://www.googleapis.com/auth/firebase.messaging"
oauth2.Initialize(Me, "oauth2", ClientID, Scope, ClientSecret, dirToken)
''oauth2.ResetToken ' for debugging
oauth2.GetAccessToken
Wait For OAuth2_AccessTokenAvailable (Success As Boolean, rToken As String)
Log("oAuth2 Success = " & Success)
If Success Then
Token = rToken
LogColor("GoogleSignon SUCCESS!", clrApp)
LogColor("new token = " & Token, clrApp)
Else
LogError("GoogleSignOn Success FALSE")
oauth2.ResetToken
Token = ""
End If
Return Success
End Sub
...
GoogleSignon SUCCESS!
new token = ya29.A0ARrdaM8iKn2rhB-3VrAM7k0pxM0iPWcf1cLxDyeQwLA8MVmwhhM32cU9OlJlvu1Cpp_smGUWzW3qQR0JnzHa2nXeltQFEoZw5bE75Xp23qERrPv-T6QkzCPzFJcUjghMIppJwxwP0E2E9_0FULajvunMuKa5AA
I would think that https://www.googleapis.com/auth/firebase.messaging would get me to the right place.
I have tried to mess around with this. I use it in the B4A app, but cannot find a FirebaseAuth lib that works in B4J:
https://www.b4x.com/android/forum/threads/b4x-b4xpages-firebasepush-firebaseauth.122477/#content
I have triple-sight-verified that the Server Key is correct and that the FCM API stuff is enabled in the G-Cloud. I also get a nice explanation of the requested permission from Mr. Google in a newly-opened browser.