signin = {
const url = "https://authorization.cerner.com/tenants/ec2458f2-1e24-41c8-b71b-0e701af7583d/protocols/oauth2/profiles/smart-v1/personas/patient/authorize?response_type=code&client_id="+client_id+"&scope=patient%2FObservation.read%20patient%2FCondition.read%20patient%2FPatient.read%20patient%2FServiceRequest.read%20patient%2Flaunch&redirect_uri="+encodeURIComponent(redirect_uri)+"&aud=https%3A%2F%2Ffhir-myrecord.cerner.com%2Fr4%2Fec2458f2-1e24-41c8-b71b-0e701af7583d&state=eoEMUE98YP5HI591";
invalidation.then(() => URL.revokeObjectURL(url));
return function() {
return new Promise((resolve, reject) => {
const popup = window.open(url, "_blank");
popup.addEventListener("submit", event => {
event.preventDefault();
popup.close();
const login = event.target.login.value.trim();
if (!login) return reject(new Error("empty"));
resolve({login});
});
popup.addEventListener("unload", () => {
if (popup.closed) reject(new Error("closed"));
});
});
};
}