skip to Main Content

I’m starting to build a service in Rust that publishes Firebase messages and plan on using the fcm crate (https://docs.rs/fcm/latest/fcm/).

I’m confused as to what the registration id is? I don’t see that in the cloud console.

Thanks for your help

let client = fcm::Client::new();

let mut map = HashMap::new();
map.insert("message", "Howdy!");

let mut builder = fcm::MessageBuilder::new("<Registration ID>", "<registration id>"); **// What is the registration id?**
builder.data(&map);

let response = client.send(builder.finalize()).await?;
println!("Sent: {:?}", response);

2

Answers


  1. Chosen as BEST ANSWER

    Thank you @Jack !

    I'm getting an Unauthorized error from the fcm sdk in Rust. I'm able to publish from Node successfully.

    In Node, I pass in quite a bit more info to firebase but in the fcm client it's only asking for the api key and registration key.

    I don't see a way to pass project_id, client_id, etc. to Rust. Is this not required? Any ideas as to why I'm getting the unauthorized error?

    config from node:
    fcmMessengerSettings: { "type": "service_account", "project_id": "project_id", "private_key_id": "private_key_id", "private_key": "private_key", "client_email": "client_email", "client_id": "client_id", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "cert_url", "universe_domain": "googleapis.com" }


  2. It’s an array of registration tokens.And you get the token by calling FirebaseInstanceId.getInstance().getToken()

    In your Rust code, replace <Registration ID> with the actual registration token obtained from your client app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search