Skip to content

Commit b53e60c

Browse files
committed
Convert Auth scheme to "WebPush"
1 parent 1a581a5 commit b53e60c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

js/vapid.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class VapidToken {
186186
return this.export_public_raw()
187187
.then( pubKey => {
188188
return {
189-
authorization: "Bearer " + content + "." + sig,
189+
authorization: "WebPush " + content + "." + sig,
190190
"crypto-key": "p256ecdsa=" + pubKey,
191191
publicKey: pubKey,
192192
}
@@ -207,7 +207,8 @@ class VapidToken {
207207
*/
208208

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

0 commit comments

Comments
 (0)