Skip to content

Ay caramba, clarifying the FORMAT of the deviceToken !! #145

Open
@smhk

Description

@smhk

From the home page:

apnProvider.send(note, deviceToken).then( (result) => {
});

In iOS:

    func application(_ application: UIApplication,
                                        didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        sendToOurServer( deviceToken.base64EncodedString() )

That string looks like this

gCP1Obmj2HS666szreBiMa5bPT3I/igmjNKdPgKYrKtknA39NTwqMWxQV7YHYwv1plKQcmbgVDQFQofG5WG2lPMRVcdaChR2YCAvKs/f0p0=

In node:

async function sendNotifs() {
	for (const aBase64Token of global.known_apns_tokens) {
		const aTokenData = Buffer.from(aBase64Token, 'base64').toString('hex')
                ...
		apnProvider.send(note, aTokenData).then((result) => {

That string looks like this

8023f539b9a3d86666770b33ade06231ae5b3d3dc8fe28268cd29d3e0298acab649c0dfd356666316c5057b607630bf5a652907266e05434054287c6e561b694f31155c75a0a147660202f2acfdfd29d

Is that in fact correct - the formula is Buffer.from(aBase64Token, 'base64').toString('hex') ...?

assuming you use base64 (ie ".base64EncodedString()") for your communications from iOS devices.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions