angular-pusher icon indicating copy to clipboard operation
angular-pusher copied to clipboard

Set auth header after config phase

Open finishingmove opened this issue 10 years ago • 6 comments

Is it possible to set the auth header after angular's config phase (i.e. without going through PusherServiceProvider). At the configuration stage I still don't have the token.

finishingmove avatar May 29 '14 14:05 finishingmove

It's currently being used as soon as you "get" the Pusher factory in your controller. I think the code can be refactored to wait to call the actual Pusher api and allow passing in the token from your controller.

I might have some time to make that change later, but it might not be until this weekend.

doowb avatar May 29 '14 14:05 doowb

Ok, I see. Thanks for the quick reply.

finishingmove avatar May 29 '14 14:05 finishingmove

@finishingmove how did you solve this for you? I need to work with WSSE headers.

clicktrend avatar Sep 30 '14 11:09 clicktrend

@clicktrend I went with a custom solution. I created a simple Pusher wrapper that accepts my token service as a dependency. My Pusher factory then returns a promise that is resolved when the token is resolved. So I can use it in my controllers like this:

Pusher.then(function resolved(PusherInstance) {
  PusherInstance.doWhatever(...);
});

finishingmove avatar Sep 30 '14 11:09 finishingmove

@finishingmove could you provide the code for your factory? I'm trying to achieve the same thing but can't really figure it out.

modess avatar Nov 30 '14 12:11 modess

@finishingmove I'd like to see your solution also.

jaesung2061 avatar Dec 16 '14 22:12 jaesung2061