Webhooks - Authorization Bearer Token

Hey Guys,

i have problem to submitt the Authorization Bearer Token via webhooks for a webservice.
The response is allways Unauthorized

I found out, that the token miss character at the end of the token if i submit via webhooks.

here is my webhook:

{
  "eventName": "MyWebHook",
  "url": "https://MyUrl/api/v1/play",
  "requestType": "POST",
  "headers": {
    "Authorization": "bearer {{my_token}}"
  },
  "mydevices": true
}

and the part of the firmware where i publish:

Particle.publish("MyWebHook", "{ \"my_token\": \"" + token + "\"}", 60, PRIVATE);

this is the response to get the token (Dashboard):

{"data":"{\"token\":\"vAHwdnsiaSI6IjM5ZTJjNmU5LWNiODAtNDk0ZS05NzI1LWI4ZGIzZGQ5MTk4OCIsImIiOiJkOWZhODA5ZS1mYTFhLTQ4YzMtOTNjYy1jMjc2NjliNDdiMTQiLCJ1IjoicGFydGljbGUiLCJ0IjoxNDUyMjU0ODk5LCJzAUnwQDMzMTI4MmZkYjFmNTJhOWFjOTNkMDY5ZTI0YmJmNjBiOTJiNGRkNjgzZTAwY2MxZTI2NDQ2NjcwYjExZmQ3YSJ9\",\"botId\":\"XXXXX\",\"success\":true}","ttl":"60","published_at":"2016-01-08T12:07:54.915Z","coreid":"particle-internal","name":"hook-response/getToken/0"}

i save this token in the variable token.

this is shown (Dashboard) if i publish the MyWebHook Webhook

{"data":"{
 \"my_token\": 
\"vAHwdnsiaSI6IjM5ZTJjNmU5LWNiODAtNDk0ZS05NzI1LWI4ZGIzZGQ5MTk4OCIsImIiOiJkOWZhODA5ZS1mYTFhLTQ4YzMtOTNjYy1jMjc2NjliNDdiMTQiLCJ1IjoicGFydGljbGUiLCJ0IjoxNDUyMjU0ODk5LCJzAUnwQDMzMTI4MmZkYjFmNTJhOWFjOTNkMDY5ZTI0YmJmNjBiOTJiNGRkNjgzZTAwY2MxZTI2NDQ2","ttl":"60","published_at":"2016-01-08T12:08:20.498Z","coreid":"XXXX","name":"MyWebHook"}

The Part: NjcwYjExZmQ3YSJ9 is missing.

i double checked the token variable. Its complete.

How long is your published data?
https://docs.particle.io/reference/firmware/photon/#particle-publish-

states

@GetMeOutOfHere, we confirmed the 255 byte limit for the publish. Your token by itself is 256 bytes :confused:

1 Like

you are right.
I can´t use particle webhooks for that :unamused:

How often does your token change and would you dare to put it into the webhook definition instead? (if that’s possible at all)
The 255 limit only applies to Particle.publish() but not the webhook as such.

Token change with every login and will lose his validity after one hour.
That is much to often to put the token into the webhook definition.

The Service use JSON Web Tokens - > https://jwt.io/

JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.

Too bad :wink:

yes but thanks alot for your answers.

I see this is a pretty old thread, is there any way around this now?