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

Save token info in DB #173

Open
baloodevil opened this issue Oct 3, 2023 · 0 comments
Open

Save token info in DB #173

baloodevil opened this issue Oct 3, 2023 · 0 comments

Comments

@baloodevil
Copy link

I am trying to persist token information to a database so that the system can connect on the user's behalf. The token includes scope for offline_access. In the callback page...

	const client = await smart(req, res).ready();
	const tokenResponse = client.getState("tokenResponse");
	// Save tokenResponse to database

Then on another page...

	// Load tokenResponse from database
	const options: fhirclient.ClientState = {
		serverUrl: "https://somefhirserver.com/fhir",
		tokenResponse,
	};
	const client = smart(req, res).client(options);

But this results in Error: Unable to refresh. No tokenUri found. First, why is it trying to refresh if the original tokenResponse was generated within the 3600 second timeframe? I can see that fhirclient checks session for SMART_KEY, then uses that name to get another object that includes tokenResponse. Maybe I need to store the entire object (the one has tokenResponse and other properties like redirectUri) and pass that as options.

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

1 participant