Created
June 26, 2017 14:17
-
-
Save paluchas/9418142d49051a2a99718fa051e23ea1 to your computer and use it in GitHub Desktop.
Our PHP code snippet used to set up ORCID API scopes as well as customise an OAuth form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generic connector to route to create initiate Orcid Auth process. | |
* While we are only using the app to read data (in the intial phase) | |
* we need all the scopes: /read-limited, /activities/update and /person/update. | |
* | |
* @return redirect to authorization URL | |
*/ | |
public function connect() | |
{ | |
$this->oauth->setClientId(config('orcid.client_id')) | |
->setScope('/read-limited /activities/update /person/update') | |
->setGivenNames(\App\Orcid::getGivenName()) | |
->setFamilyNames(\App\Orcid::getFamilyName()) | |
->setEmail(\App\Orcid::getEmailAddress()) | |
->setRedirectUri(config('orcid.redirect')."/authenticated"); | |
return redirect($this->oauth->getAuthorizationUrl()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment