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
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ CSS class for the login button.

Text content for the login button.

#### `requireCode`

`{boolean}`

Allow skiping 'code' key presence validation on success result, to skip pass 'false' value.

#### `onRequest`

`{function}`
Expand All @@ -63,13 +69,13 @@ Callback for every request.

#### `onSuccess`

`{function}`
`{function}` _required_

Callback for successful login. An object will be passed as an argument to the callback, e.g. `{ "code": "..." }`.

#### `onFailure`

`{function}`
`{function}` _required_

Callback for errors raised during login.

Expand Down
2 changes: 1 addition & 1 deletion dist/GitHubLogin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/GitHubLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class GitHubLogin extends Component {
static defaultProps = {
buttonText: 'Sign in with GitHub',
scope: 'user:email',
requireCode: true,
onRequest: () => {},
onSuccess: () => {},
onFailure: () => {},
Expand Down Expand Up @@ -50,7 +51,7 @@ class GitHubLogin extends Component {
}

onSuccess = (data) => {
if (!data.code) {
if (this.props.requireCode && !data.code) {
return this.onFailure(new Error('\'code\' not found'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/PopupWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PopupWindow {
return;
}

const params = toParams(popup.location.search.replace(/^\?/, ''));
const params = toParams(decodeURIComponent(popup.location.search.replace(/^\?/, '')));

resolve(params);

Expand Down