strongloop/loopback-component-push

Getting JWT Token must be defined, property "token" is undefined in v3.0.0

Closed this issue · 4 comments

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

I installed loopback-component-push on my server (^3.0.0) and set up push notifications using the example code and tutorial as a guide. When I ran the server and attempted to POST to create a notification, server crashed.

Expected result

I expected to receive a notification on my mobile device.

Actual result (if bug)

Server crashed, with the following error.

AssertionError: JWT Token must be defined, property "token" is undefined.

Additional information (Node.js version, LoopBack version, etc)

Loopback ^3.0.0
loopback-component-push ^3.0.0

Everything works fine if I change loopback-component-push to 1.5.1

It looks like the validation is looking at the application's pushSettings - but the documentation doesn't mention anything about adding a token object?

That's the new apple fancy way of security without all these certificate stuff. Checkout #131, #142
I think there should be an option to go on with the old fashion 👍 +1

Oh okay, sorry I missed it.

Is there documentation for the new method?

@kahyoung Check out here.
Start reading from "Generate an auth key".
After setting all that cool things, you can update the settings in push-demo.js. Check also

Hours later:...
I couldn't get it run anyway, I had this strange problem about apn asking to specify the port.. hmm
I don't know if that should have been happening.. It's working though.

pushOptions: {
    // Extra options can go here for APN
    port: "2197"
}

Documentation has been updated on the main loopback site:

http://loopback.io/doc/en/lb3/Push-notifications.html