Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

This sample will show how to request authorization for an app, using the SMART on FHIR JavaScript Client.

SMART on FHIR Authorization

Request Authorization

In order to receive the current user, you must request the openid and profile scopes.

Authorize
FHIR.oauth2.authorize({
    client_id: "my_client_id",
    redirect_uri: "https://mydomain.com/app/index.html",
    scope: "patient/*.read openid profile"
});

Authorization Success

After successful authorization, retrieve the resulting SMART FHIR Client. The current user's fully qualified FHIR URL is on the FHIR client at userId. 

Ex: https://sandbox.hspconsortium.org/dstu2/open-hspc-reference-api/data/Practitioner/COREPRACTITIONER1

Authorization Success
var currentUserFhirUrl;
 
FHIR.oauth2.ready(function(fhirClient){
	currentUserFhirUrl = fhirClient.userId;
});
  • No labels