Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions src/GitHubLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ 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: () => {},
onFailure: () => {},
}

onBtnClick = () => {
const { clientId, scope, redirectUri } = this.props;
const { clientId, scope, redirectUri, host } = this.props;
const search = toQuery({
client_id: clientId,
scope,
redirect_uri: redirectUri,
});
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 }
);

Expand Down