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

HSPC registration carry over #72

Open
pz12 opened this issue May 4, 2019 · 4 comments
Open

HSPC registration carry over #72

pz12 opened this issue May 4, 2019 · 4 comments

Comments

@pz12
Copy link

pz12 commented May 4, 2019

Hey all,
I'm a developer on the HSPC Sandbox team. We just kicked off the ability to register and test cds-hooks in the HSPC Sandbox. These services are persisted in the backend and therefore are always available to the user. My question is whether it would be possible to pass those registered discovery endpoints to the cds-hooks sandbox when it is launched in a user's HSPC sandbox?
It seems that those endpoints are stored in LocalStorage under the "PERSISTED_cdsServices" variable. Is this correct?
One idea I have would be to have the ability to include a list of cdsServices in the app launch context which would be available at the token response. Then the cds hooks sandbox could add those services to the ui. The question would be, should these endpoints be added to the localStorage "PERSISTED_cdsServices" variable or a sessionStorage variable that doesn't persist beyond the app launch.

@pz12
Copy link
Author

pz12 commented May 4, 2019

Actually, I see that I can register a launch context called "serviceDiscoveryURL" that allows us to pass one url, but not a list.

@zplata
Copy link
Contributor

zplata commented May 4, 2019

@pz12 You're correct in that you should use the serviceDiscoveryURL param when launching the CDS Hooks Sandbox as a SMART app from your HSPC sandbox. At the time this functionality was introduced, there was only a need for testing one service discovery endpoint. The sandbox actually supports multiple serviceDiscoveryURL URL query params if the tool is launched "openly", and is noted here.

To support what you're asking, I think similar changes just have to be implemented in the SMART onAuthSuccess function (just iterating over an array of CDS services and async calling the retrieveDiscoveryServices function to store them in-app) noted here

And finally some work in the reducer here to just make sure the action.discoveryUrl isn't in the access token serviceDiscoveryURL list here.

@pz12
Copy link
Author

pz12 commented May 5, 2019

Pull request: #73

@dennispatterson
Copy link
Collaborator

@pz12 I merged your PR and it's been deployed. I noticed that you didn't make Zach's suggested changes to the cds-services-reducers to account for attempting to add a discovery url that has already been discovered via the access token. There's not likely to be huge impact, but this comparison wouldn't work properly if the token contains a list.

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

3 participants