diff --git a/README.md b/README.md index 8beb317..aba57d0 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ Callback for successful login. An object will be passed as an argument to the ca Callback for errors raised during login. +#### `host` + +`{string}` + +Host for Github login. Defaults to `https://github.com`. +Can be provided to allow login with Github Enterprise. ## Development diff --git a/src/GitHubLogin.js b/src/GitHubLogin.js index e70aec3..f303480 100644 --- a/src/GitHubLogin.js +++ b/src/GitHubLogin.js @@ -15,11 +15,13 @@ class GitHubLogin extends Component { onFailure: PropTypes.func, redirectUri: PropTypes.string, scope: PropTypes.string, + host: PropTypes.string, } static defaultProps = { buttonText: 'Sign in with GitHub', redirectUri: '', + host: 'https://github.com', scope: 'user:email', onRequest: () => {}, onSuccess: () => {}, @@ -27,7 +29,7 @@ class GitHubLogin extends Component { } onBtnClick = () => { - const { clientId, scope, redirectUri } = this.props; + const { clientId, scope, redirectUri, host } = this.props; const search = toQuery({ client_id: clientId, scope, @@ -35,7 +37,7 @@ class GitHubLogin extends Component { }); const popup = this.popup = PopupWindow.open( 'github-oauth-authorize', - `https://github.com/login/oauth/authorize?${search}`, + `${host}/login/oauth/authorize?${search}`, { height: 1000, width: 600 } );