Skip to content

Commit

Permalink
Convert Auth scheme to "WebPush"
Browse files Browse the repository at this point in the history
  • Loading branch information
jrconlin committed Oct 3, 2016
1 parent 1a581a5 commit b53e60c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/vapid.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class VapidToken {
return this.export_public_raw()
.then( pubKey => {
return {
authorization: "Bearer " + content + "." + sig,
authorization: "WebPush " + content + "." + sig,
"crypto-key": "p256ecdsa=" + pubKey,
publicKey: pubKey,
}
Expand All @@ -207,7 +207,8 @@ class VapidToken {
*/

// Ideally, just the bearer token, Cheat a little to be nice to the dev.
if (token.toLowerCase().split(" ")[0] == "bearer") {
scheme = token.toLowerCase().split(" ")[0]
if (scheme == "bearer" || scheme == "webpush") {
token = token.split(" ")[1];
}

Expand Down

0 comments on commit b53e60c

Please sign in to comment.