Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send to iOS asks for pass phrase in console

nbastoWM opened this issue · comments

commented

I have a Certificate with a pass phrase and when I use it it asks for pass phrase in the console:
Enter PEM pass phrase:

My configuration:

  'apn' => [
      'certificate' => __DIR__ . '/iosCertificates/certificate2.pem',
      'passPhrase'  => '1234', //Optional
      //   'passFile'    => __DIR__ . '/iosCertificates/yourKey.pem', //Optional
      'dry_run'     => true
  ]

My code:

$push = new PushNotification('apn');

        $push->setMessage([
                    'aps' => [
                        'alert' => [
                            'title' => $data['title'],
                            'body'  => $data['description']
                        ],
                        'sound' => 'default'

                    ],
                    'extraPayLoad' => [
                        'type' => $data['type'],
                        'id'   => $data['id'],
                    ]
                ])
            ->setDevicesToken([$devicetoken])
            ->send();

After writing 1234 in the console it sends the notification. Am I missing something?

That's weird.
Could you send by mail that certificate and a device token so that I can try to replicate the issue?

mail id: edujugon@gmail.com

commented

Ok. I found out the problem was the certificate conversion from p12 to pem.
First I was using the command line to do it but then I tried an online converter and it worked fine.
Can you tell me the right way to convert those certificates to PEM files?

Thank you.

I'm glad to know you solved the issue.
In regard to convert certificates to PEM files, have a look at this: pem and let me know if it was useful.

After your update, I'm closing this issue since it was solved.