Git Product home page Git Product logo

Comments (5)

jeromegamez avatar jeromegamez commented on July 22, 2024

I hope you don't really expect me to go through hundreds of lines of unformatted stack traces just to take a guess what the problem might be :). Please at least format code blocks as described for example at https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks

from laravel-firebase.

jeromegamez avatar jeromegamez commented on July 22, 2024

In general: if you expect to get JSON but instead get HTML, there's probably a problem with the request you're making. Please show me the code (only the relevant parts, and formatted) that you wrote using the SDK that leads to the error.

from laravel-firebase.

thaifani avatar thaifani commented on July 22, 2024

sorry for that but the response status is OK
but response not json this first
second when i add to dadabase it worked perfectly but when do messaging return this error
message":"SenderId mismatch","code":403,"status_code":500

this my code

 public function sendNotification($deviceToken)
    {
     
      $firebase   = (new Factory)
            ->withServiceAccount(__DIR__.'/enjeiz-firebase-adminsdk-da7sz-a31e87e601.json')
            ->withDatabaseUri('https://enjeiz.firebaseio.com/');
        $database   = $firebase->createDatabase();
        $createPost = $database
            ->getReference('dbnameEx')
            ->push([
                'title' => 'some title',
                'body'  => 'som body text.'
            ]);
        $resltsend  = $createPost->getvalue();  //this worked
        
        $messaging  = $firebase->createMessaging();
        $message    = CloudMessage::withTarget('token', $deviceToken)
            ->withNotification(Notification::create('someTitle', 'bodyTxt'))
            ->withData(['firstKey' => 'firstValue']);
        $resultMsg  = $messaging->send($message);// this return message":"SenderId mismatch","code":403,"status_code":500
...
....

I dont use this library

i use the original
https://github.com/kreait/firebase-php

from laravel-firebase.

thaifani avatar thaifani commented on July 22, 2024

thanks for you time with me
the SenderId mismatch error was because the firebase update the keyserver and the devicesTokens was old

from laravel-firebase.

jeromegamez avatar jeromegamez commented on July 22, 2024

Uh, I have the feeling that I didn‘t really help much, next time I‘ll do better! Nonetheless I‘m glad you found the solution and shared it here, this will certainly be useful for others (and I‘ll try to keep it in mind the next time a similar problem occurs).

Thank you! 🌺

from laravel-firebase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.