Skip to content

Commit

Permalink
Bearer token Authorization support (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
parallels999 authored Aug 26, 2022
1 parent 6332f3d commit a26aed5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/connector/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export abstract class Connector {
},
broadcaster: 'pusher',
csrfToken: null,
bearerToken: null,
host: null,
key: null,
namespace: 'App.Events',
Expand Down Expand Up @@ -46,6 +47,13 @@ export abstract class Connector {
this.options.userAuthentication.headers['X-CSRF-TOKEN'] = token;
}

token = this.options.bearerToken;

if (token) {
this.options.auth.headers['Authorization'] = 'Bearer ' + token;
this.options.userAuthentication.headers['Authorization'] = 'Bearer ' + token;
}

return options;
}

Expand Down

0 comments on commit a26aed5

Please sign in to comment.