diff --git a/src/backends/github/AuthenticationPage.js b/src/backends/github/AuthenticationPage.js index 97cec461..f7100604 100644 --- a/src/backends/github/AuthenticationPage.js +++ b/src/backends/github/AuthenticationPage.js @@ -14,8 +14,13 @@ export default class AuthenticationPage extends React.Component { handleLogin(e) { e.preventDefault(); + let auth; + if (document.location.host.split(':')[0] === 'localhost') { + auth = new Authenticator({ site_id: 'cms.netlify.com' }); + } else { + auth = new Authenticator(); + } - const auth = new Authenticator({site_id: 'cms.netlify.com'}); auth.authenticate({provider: 'github', scope: 'repo'}, (err, data) => { if (err) { this.setState({loginError: err.toString()}); diff --git a/src/lib/netlify-auth.js b/src/lib/netlify-auth.js index 54a75283..b22b8c6b 100644 --- a/src/lib/netlify-auth.js +++ b/src/lib/netlify-auth.js @@ -29,8 +29,8 @@ const PROVIDERS = { }; class Authenticator { - constructor(config) { - this.site_id = config.site_id; + constructor(config = {}) { + this.site_id = config.site_id || null; this.base_url = config.base_url || NETLIFY_API; }