Skip to content

Commit

Permalink
[1.x] Replaces deprecated auth options for default Pusher (#407)
Browse files Browse the repository at this point in the history
* swap out deprecated channel auth options

* add missed header assignment
  • Loading branch information
ProjektGopher authored Jan 7, 2025
1 parent 8234ce0 commit fad5599
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/connector/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export abstract class Connector<TPublic extends Channel, TPrivate extends Channe
* Default connector options.
*/
private _defaultOptions: any = {
auth: {
channelAuthorization: {
endpoint: '/broadcasting/auth',
headers: {},
},
authEndpoint: '/broadcasting/auth',
userAuthentication: {
endpoint: '/broadcasting/user-auth',
headers: {},
Expand Down Expand Up @@ -43,14 +43,14 @@ export abstract class Connector<TPublic extends Channel, TPrivate extends Channe
let token = this.csrfToken();

if (token) {
this.options.auth.headers['X-CSRF-TOKEN'] = token;
this.options.channelAuthorization.headers['X-CSRF-TOKEN'] = token;
this.options.userAuthentication.headers['X-CSRF-TOKEN'] = token;
}

token = this.options.bearerToken;

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

Expand Down

0 comments on commit fad5599

Please sign in to comment.