react-orcid-login
v1.1.0
Published
React Component for ORCID SSO Login using OAUTH
Downloads
18
Maintainers
Readme
React ORCID Login
React component for ORCID login.
Usage
import React from 'react';
import ReactDOM from 'react-dom';
import OrcidLogin from 'react-orcid-login';
const onSuccess = response => console.log(response);
const onFailure = response => console.error(response);
ReactDOM.render(
<OrcidLogin clientId="YOUR_CLIENT_ID"
onSuccess={onSuccess}
onFailure={onFailure}/>,
document.getElementById('example')
);
Props
clientId
{string}
required
Client ID for ORCID OAuth application.
redirectUri
{string}
Registered redirect URI for ORCID OAuth application.
scope
{string}
Scope for ORCID OAuth application. Defaults to '/authenticate'
.
className
{string}
CSS class for the login button.
buttonText
{string}
Text content for the login button.
onRequest
{function}
Callback for every request.
onSuccess
{function}
Callback for successful login. An object will be passed as an argument to the callback, e.g. { "code": "..." }
.
onFailure
{function}
Callback for errors raised during login.
isSandbox
{bool}
Flag to decide which url to use. The sandbox or the production one.
Development
$ npm start
Webpack development server starts at http://localhost:8080