sandbox icon indicating copy to clipboard operation
sandbox copied to clipboard

HSPC registration carry over

Open pz12 opened this issue 6 years ago • 4 comments

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 avatar May 04 '19 14:05 pz12

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

pz12 avatar May 04 '19 15:05 pz12

@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.

zplata avatar May 04 '19 18:05 zplata

Pull request: https://github.com/cds-hooks/sandbox/pull/73

pz12 avatar May 05 '19 18:05 pz12

@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.

dennispatterson avatar Aug 06 '19 22:08 dennispatterson