lib/twitch.auth.js
function login(options) {
  if (!gui.isActive()) {
    throw new Error('Cannot login without a GUI.');
  }

  if (!options.scope) {
    throw new Error('Must specify list of requested scopes');
  }
  var params = {
    response_type: 'token',
    client_id: core.clientId,
    redirect_uri: 'https://api.twitch.tv/kraken/',
    scope: options.scope.join(' '),
  };

  if(options.force_verify) {
    params.force_verify = true;
  }

  if (!params.client_id) {
    throw new Error('You must call init() before login()');
  }

  gui.popupLogin(params);
}
function login(options) {
  if (!gui.isActive()) {
    throw new Error('Cannot login without a GUI.');
  }

  if (!options.scope) {
    throw new Error('Must specify list of requested scopes');
  }
  var params = {
    response_type: 'token',
    client_id: core.clientId,
    redirect_uri: 'https://api.twitch.tv/kraken/',
    scope: options.scope.join(' '),
  };

  if(options.force_verify) {
    params.force_verify = true;
  }

  if (!params.client_id) {
    throw new Error('You must call init() before login()');
  }

  gui.popupLogin(params);
}
function login ( options ) { if ( ! gui . isActive ( ) ) { throw new Error ( 'Cannot login without a GUI.' ) ; } if ( ! options . scope ) { throw new Error ( 'Must specify list of requested scopes' ) ; } var params = { response_type : 'token' , client_id : core . clientId , redirect_uri : 'https://api.twitch.tv/kraken/' , scope : options . scope . join ( ' ' ) , } ; if ( options . force_verify ) { params . force_verify = true ; } if ( ! params . client_id ) { throw new Error ( 'You must call init() before login()' ) ; } gui . popupLogin ( params ) ; }
Opens a login popup for Twitch if the SDK was initialized with a GUI and
the user is not logged in yet.
@method login
@param {Object} options
@example
```javascript
Twitch.login({
scope: ['user_read', 'channel_read']
});
```
Opens a login popup for Twitch if the SDK was initialized with a GUI and the user is not logged in yet .