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

PusherService configuration outside config block. Is it possible? #26

Open
willian opened this issue Jan 20, 2015 · 1 comment
Open

Comments

@willian
Copy link

willian commented Jan 20, 2015

First of all, thanks for this library @doowb.

I have something like this:

var userAuthenticationToken = window.sessionStorage.authenticationToken;
if (userAuthenticationToken !== '') {
  PusherServiceProvider
    .setToken(PUSHER_KEY)
    .setOptions({
      authEndpoint: API_URL + '/v1/pusher/auth',
      auth: {
        headers: {
          'Authorization': 'Token token=' + userAuthenticationToken
        }
      }
    });
}

That's because my Backend API requires an authenticated user in order to authenticate Pusher.

The problem is: sometimes usre is not logged in, so I show a sign in form to him, he logs in and I can't make a request to authenticate Pusher because .config block can't be called any more.

Is there a way to call PusherService in order to make an authentication again?

Thanks in advance for any help :)

@doowb
Copy link
Owner

doowb commented Apr 23, 2015

I've been away from angular for a little while. Is there a way to "reload" a ServiceProvider obj in an angular app? If not, I guess I should add a way to do this in a controller. I think a solution for this will resolve a few other issues too.

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