-
Notifications
You must be signed in to change notification settings - Fork 200
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
State param not available after redirect #48
Comments
Hi @martijnkorteweg, Thank you for checking out the latest version! There might be an issue, but I will need more info to reproduce it.
That is how it is supposed to work, unless you've set The real problem would be that you don't have SMART_KEY set in your sessionStorage. Can you share more details? How are you launching your app, in what browser and OS, against which FHIR server, etc P.S. This is to be released soon, but until then it changes frequently. You might have tried an already outdated version. Until it gets to NPM, it might be more convenient to make sure you are always using the latest build by including it as so: <script src="https://combinatronics.com/smart-on-fhir/client-js/master/build/fhir-client.js"></script> |
thanks for replying so quickly, here are some more details on how we have it setup
if you do want to recreate with angular 6, you will need to import fhirClient in polyfills.ts before zone.js gets imported otherwise they conflict and start yelling :) as far as not having SMART_KEY set in sessionStorage, i don't see this being set at all in in
how ever this sets |
Hi @martijnkorteweg , I don't do Anglular so I hope you can excuse my confusion. In general though, I would say that you should be careful how you use this library, because it is doing some "global" stuff like redirects and sessionStorage manipulation. Here are some advices that might help with this:
// This should be fine
FHIR.oauth2.ready().then(client => {
// Create/initialize my app
});
// This might not work properly (pseudo code)
const app = new App();
app.onSomeRoute(() => FHIR.oauth2.ready());
As for the auth flow, the SMART_KEY is only written once the authorization is complete at https://github.com/smart-on-fhir/client-js/blob/master/src/smart.js#L343 |
It seems i have found the issue, it def has something todo with angular. the redirect lands on Trying to figure out a work around for this. will let you know where i land on this |
Hey @vlad-ignatov thank you for you time. |
After the redirect happens the state param on the url seems to disappear in our application. It does get set as the redirect url however when login is complete the state param is gone.
I did see in
smart.js line:247
that you try to retrieve the state key if no key is set on the url. however a sessionStorage with "SMART_KEY" never gets set inauthorize()
.I was able to work around this by adding the state to sessionStorage with the smart_key in
authorize()
and then setting the key incompleteAuth()
like thisthis seems like a bit of a hack and there is probably an issue i am not seeing with the redirect.
The text was updated successfully, but these errors were encountered: