Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send token or other data #55

Open
wojtekhorembala opened this issue Aug 6, 2019 · 3 comments
Open

How to send token or other data #55

wojtekhorembala opened this issue Aug 6, 2019 · 3 comments

Comments

@wojtekhorembala
Copy link

wojtekhorembala commented Aug 6, 2019

Hi, in the web application I use signalR for angular
(https://www.npmjs.com/package/@aspnet/signalr)

When i connected, I send token, example from web app. (accessTokenFactory)

this.notifyHubConnection = new signalR.HubConnectionBuilder()
 .withUrl(`${ this.apiUrl }hub/messages`, { accessTokenFactory: () => token })
 .build();
this.notifyHubConnection.start().catch((err) => this.hubReconnect());
this.notifyHubConnection.on('OnMessageReceived', (sender, senderID, content) => {...});

This is what my code looks like in a web application, can anyone help me open it in this library?

@SowinskiMateusz
Copy link

I have the same problem.

@SowinskiMateusz
Copy link

Propably I found the solution:

const connection = signalr.hubConnection('url', { headers: { 'Authorization': Bearer ${valueObj.token}, 'Content-Type': 'text/plain;charset=UTF-8' } }

@wojtekhorembala
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants