Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Account impersonation & Apollo... #44

Open
Siyfion opened this issue Oct 19, 2016 · 8 comments
Open

Account impersonation & Apollo... #44

Siyfion opened this issue Oct 19, 2016 · 8 comments
Labels
feature Feature: new addition or enhancement to existing solutions help wanted

Comments

@Siyfion
Copy link
Contributor

Siyfion commented Oct 19, 2016

So I've been using a form of account impersonation for my admin team to manage other people's accounts and/or data without knowing their passwords, etc.

Loosely based on https://dweldon.silvrback.com/impersonating-a-user I use, @gwendall's https://github.com/gwendall/meteor-impersonate

Would it be possible to somehow integrate these two packages, so that the impersonation isn't "lost" in the Apollo data endpoints.

Perhaps @lorensr will have some words of wisdom!? 👍

@Siyfion
Copy link
Contributor Author

Siyfion commented Nov 2, 2016

It'd be nice to get @gwendall involved in this; though I'm not sure how active he is these days.

@Siyfion
Copy link
Contributor Author

Siyfion commented Nov 2, 2016

@lorensr I tried modifying the code to store the login token, but I can't get it working because in @gwendall's client code it seems to never have the token for the impersonated client, only for the "original" user. It seems to use Meteor.connection.setUserId(res.toUser); on the client and this.setUserId(params.toUser); on the server to manually set the userId.

@lorensr
Copy link
Contributor

lorensr commented Nov 2, 2016

Could modify the method to always return the token of the target user

On Wednesday, November 2, 2016, Simon Mansfield [email protected]
wrote:

@lorensr https://github.com/lorensr I tried modifying the code to store
the login token, but I can't get it working because in @gwendall
https://github.com/gwendall's client code it seems to never have the
token for the impersonated client, only for the "original" user. It seems
to use Meteor.connection.setUserId(res.toUser); on the client and
this.setUserId(params.toUser); on the server to manually set the userId.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#44 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPVmIF7NVbI3JkZUvhDM8v35w1NBr61ks5q6Kg4gaJpZM4KbBm3
.

@Siyfion
Copy link
Contributor Author

Siyfion commented Nov 2, 2016

Tried that, but weird stuff™ happens. (I am briefly logged in as the impersonated user and then immediately kicked out.)

I wish I understood the impersonate code better, as I think it could use a bloody good tidy up and NPM'ifying, but I just don't get it well enough to try. Shame it's not a core Meteor bit of functionality really, as I'm sure it's useful for a lot of people. (Just look at the most recent reference to this issue!)

@lorensr lorensr added feature Feature: new addition or enhancement to existing solutions help wanted labels Nov 3, 2016
@jamiter
Copy link

jamiter commented Nov 5, 2016

I'll just do a quick plug of our package here that solved all of these issue:

https://github.com/Swydo/ddp-apollo

This allows you to use DDP for data transport. So it uses all the Meteor authentication that you're used to. It's probably not going to be the default implementation, see discussion here, but it helped us to use Apollo with a solid and backward compatible authentication mechanism. You can leave any questions in that repo.

@etyp
Copy link

etyp commented Aug 27, 2017

@Siyfion did you ever have any luck implementing this?

@Siyfion
Copy link
Contributor Author

Siyfion commented Aug 30, 2017

@etyp No... I did it all a slightly different way. I ended up tweaking the server authentication logic to allow a login if the password matched a randomly generated short-lifetime hash. This hash was then provided to the administrators and they can access all the accounts in this manner.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature: new addition or enhancement to existing solutions help wanted
Projects
None yet
Development

No branches or pull requests

4 participants