lib/auth/auto_detect.js
function autoDetect(env) {
  env = env || defaultEnvironment();
  if (typeof(env.chrome) !== 'undefined' &&
    env.chrome.runtime && env.chrome.runtime.id) {
    if (env.chrome.tabs && env.chrome.tabs.create) {
      return ChromeExtensionFlow;
    } else {
      // Chrome packaged app, not supported yet.
      return null;
    }
  }
  if (typeof(env.window) !== 'undefined' && env.window.navigator) {
    // Browser
    return RedirectFlow;
  }
  if (typeof(env.process) !== 'undefined' && env.process.env) {
    // NodeJS script
    return NativeFlow;
  }
  return null;
}
function autoDetect(env) {
  env = env || defaultEnvironment();
  if (typeof(env.chrome) !== 'undefined' &&
    env.chrome.runtime && env.chrome.runtime.id) {
    if (env.chrome.tabs && env.chrome.tabs.create) {
      return ChromeExtensionFlow;
    } else {
      // Chrome packaged app, not supported yet.
      return null;
    }
  }
  if (typeof(env.window) !== 'undefined' && env.window.navigator) {
    // Browser
    return RedirectFlow;
  }
  if (typeof(env.process) !== 'undefined' && env.process.env) {
    // NodeJS script
    return NativeFlow;
  }
  return null;
}
function autoDetect ( env ) { env = env || defaultEnvironment ( ) ; if ( typeof ( env . chrome ) !== 'undefined' && env . chrome . runtime && env . chrome . runtime . id ) { if ( env . chrome . tabs && env . chrome . tabs . create ) { return ChromeExtensionFlow ; } else { // Chrome packaged app, not supported yet. return null ; } } if ( typeof ( env . window ) !== 'undefined' && env . window . navigator ) { // Browser return RedirectFlow ; } if ( typeof ( env . process ) !== 'undefined' && env . process . env ) { // NodeJS script return NativeFlow ; } return null ; }
Auto-detects the type of Oauth flow to use that's appropriate to the
environment.

@returns {Function|null} The type of Oauth flow to use, or null if no
appropriate type could be determined.
Auto - detects the type of Oauth flow to use that s appropriate to the environment .