Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anyone got this working with the new Apple p8 files #326

Open
adamgins opened this issue Dec 28, 2017 · 15 comments
Open

Anyone got this working with the new Apple p8 files #326

adamgins opened this issue Dec 28, 2017 · 15 comments

Comments

@adamgins
Copy link
Collaborator

Hi, the current params are dependent on the old p12 based certs, Apple does to issue those any more. Wondering if anyone else has got this working with the new p8 files?

@raix
Copy link
Collaborator

raix commented Dec 28, 2017

@adamgins I think we might have to bump the apn module version - there are a couple of breaking api changes around v2.0.0 https://github.com/node-apn/node-apn/releases

@adamgins
Copy link
Collaborator Author

@raix yep just looking at https://github.com/node-apn/node-apn it takes a whole bunch of the new params... eg

var options = {
  token: {
    key: "path/to/APNsAuthKey_XXXXXXXXXX.p8",
    keyId: "key-id",
    teamId: "developer-team-id"
  },
  production: false
};

I will take a crack at it and see if I can fix. I am hoping it may be simple to get APN up and running again...

@adamgins
Copy link
Collaborator Author

adamgins commented Dec 28, 2017

BTW, there is another thought of using something like Firebase (FCM), which can now send to both APN and FCM/GCM... but that probably more of a fork??? ala https://github.com/fechanique/cordova-plugin-fcm

@raix
Copy link
Collaborator

raix commented Dec 28, 2017

@raix
Copy link
Collaborator

raix commented Dec 28, 2017

@adamgins I've added a branch with the initial stab - please crack on (I'm out today and tomorrow - my birthday)

re FCM I think it would be a really nice thing to get in, (GCM is deprecating in favor of FCM right?)

@adamgins
Copy link
Collaborator Author

@raix you're "da man!!!" happy birthday :-) and Happy New Year!!!

re: FCM yes... when I logged into FCM all my GCM stuff was there

@adamgins
Copy link
Collaborator Author

adamgins commented Dec 28, 2017

@raix I cloned and just put into my packages to see if I could get working and hack as necessary

I changed apn.Device to apn.Provider in var myDevice = new apn.Provider(userToken); at https://github.com/raix/push/blob/master/lib/server/push.api.js#L187

I am getting this error Push: Could not send notification id: "ab4ikEykgKAk83RyZ", Error: ENOENT: no such file or directory, open 'cert.pem'

Seems related to this deep in the included NPM modules
https://github.com/node-apn/node-apn/blob/master/test/config.js#L22

I was a bit confused that we still needed to include

cert: Assets.getText(some_cert.pem'),
        key: Assets.getText('some_key.pem'),

I thought these were redundant with the new settings, anyway

My config is

Push.Configure({
		apn: {
			token: {
				key: Assets.getText('APN_PUSH.p8'),
				keyId: '<mykey>',
				teamId: '<myteamid>',
			},

			// passphrase: 'amonkey-surfer',
			//production: false,
			//gateway: 'gateway.push.apple.com',

		},
		gcm: {
			apiKey: '<gcmkey>',
		},
		cert: Assets.getText('<my>_cert.pem'),
		key: Assets.getText('<my>_key.pem'),
		production: false,
		'sound': true,
		'badge': true,
		'alert': true,
		'vibrate': true,
		// 'sendInterval': 15000, Configurable interval between sending
		// 'sendBatchSize': 1, Configurable number of notifications to send per batch
		// 'keepNotifications': false,
		//
	});

I ended up at https://github.com/node-apn/node-apn/blob/master/doc/provider.markdown and it still seems like cert and key are required, phew in to the APN gorp of creating keys and certs again :-/ This seems even more complex than before... been a long day, trying to get my head around this.

@paulincai
Copy link

@adamgins did you mean to say that Apple doesn't issue p12 any more? I am not able to find any info on that. What I see however is that FCM requires p8 which is easily converted from p12. Were there any announcement of discontinuation of p12 certificates?

@twentyfortysix
Copy link

twentyfortysix commented Oct 14, 2018

can anybody confirm if p12 is obsolete? I haven't found anything about it anywhere like @paulincai mentioned.
As that might be something causes my problems to send push notifications thru APN.

@paulincai
Copy link

@twentyfortysix is this a project that worked fine and stopped working or is it something that you're developing now and can't send out via APN?

@twentyfortysix
Copy link

New project that I have never been able to setup for APN.
I made a small demo, with the description.. #350

@paulincai
Copy link

As fr as I remember, you need to "distribute" your app. Can you do a ad-hoc distribution and put it in testfairy or other place and try again. For some reasons I know that you can only receive in IOS with a production app.

@twentyfortysix
Copy link

twentyfortysix commented Oct 14, 2018

Thanks for help. I tried it via TestFlight. no luck so far.

@paulincai
Copy link

I have some time for you if you want to go on a chat: paulailincai in skype

@twentyfortysix
Copy link

I have some time for you if you want to go on a chat: paulailincai in skype
mine is o----o. I have sent you request a minute ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants