Skip to content

Commit ae60b6f

Browse files
committed
Bearer token Authorization support
1 parent 6332f3d commit ae60b6f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/connector/connector.ts

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export abstract class Connector {
1515
},
1616
broadcaster: 'pusher',
1717
csrfToken: null,
18+
bearerToken: null,
1819
host: null,
1920
key: null,
2021
namespace: 'App.Events',
@@ -46,6 +47,13 @@ export abstract class Connector {
4647
this.options.userAuthentication.headers['X-CSRF-TOKEN'] = token;
4748
}
4849

50+
token = this.options.bearerToken;
51+
52+
if (token) {
53+
this.options.auth.headers['Authorization'] = 'Bearer ' + token;
54+
this.options.userAuthentication.headers['Authorization'] = 'Bearer ' + token;
55+
}
56+
4957
return options;
5058
}
5159

0 commit comments

Comments
 (0)