-
Notifications
You must be signed in to change notification settings - Fork 445
Handle multiple services #256
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
Comments
Do you use services naming?
|
Ok, then OAuth2.createService('name_of_service') not only creates the service but also returns the corresponding auth token object if the service is already created. Is this right? |
Yes, that's correct. The name of the service is part of the key used to store and retrieve tokens. |
Ok, thank you. I guess the library doesn't provide the list of created services, so a possible way to do that would be:
Is there a more "ellegant" way to do this? Maybe could be an interesting feature to add to the library. |
Ya, that could be something we add to the library. How would you use that function though? In my experience most often the services are more fixed and known to the script. |
In my case, I need to show all the connected services to the user and give him/her the option of adding more or disconnecting them (individually). For instance, Stripe handles different accounts with a single user that would correspond to different services. In general, I guess this make sense when you have to keep several services connected (Stripe accounts in my case) because the user is going to use them frequently. |
BTW, a very simple way to facilitate the manage of multiples services is that the library store them under the same property, as a list of service objects. In this way, you only need to read one property (let's say oauth2):
|
I've added |
Thank you! This function helps a lot in handling multiple services. Just one important question: the more recent service is the first one (index 0) or the last one in the service names array returned by the function? |
The function doesn't make any guarantee about the order of the returned services. However you could encode the creation date in the service name (for example
|
Hmmm that's not good news. I'd expect the library (and the function) could guarantee the correct order of the services. I have 2 ideas I hope you can consider that could solve the problem:
|
I don't think it makes sense to implement ordering in the library, given the methods I outlined for implementing it yourself and that this is a fairly niche feature. |
Sorry, I guess I disagree. It's quite strange for me that the items of an array returned by a function could be in different positions everytime you call it without any criteria (this is computer science!). I'm not telling that the order has to be necessarily the creation timestamp, but at least the criteria should be known in order to get more deterministic results. Thank you anyway for your amazing library! |
I can't find a way to connect to more than one service. When you connect a new service, It seems stored data are replaced, so you cannot handle more than one service (access token) at the same time. Is there any way to solve this?
The text was updated successfully, but these errors were encountered: