   isTeamScope: (scope) ->
 
     _.isEqual scope.split(',').sort(), TEAM_SCOPE.split(', ').sort()
+
+
+  getDetails : (provider) ->
+    title  : @providers[provider]
+    loader : @loaders[provider]
+    toggle : @toggles[provider]
+    scope  : @scopes[provider]
+    token  : @tokens[provider]

    @scopes     = {}
    @tokens     = {}
    @loaders    = {}
    @switches   = {}
    @containers = {}

    mainController = kd.getSingleton 'mainController'


  link: (provider) ->

    { loader, toggle, title } = @getDetails provider

    loader.show()

    options  = { provider }
    redirect = ->
      kd.singletons.oauthController.redirectToOauthUrl options
      new kd.NotificationView
        title    : "Redirecting to #{title}..."
        duration : 0

    if provider is 'github' and isAdmin()
      group = getGroup()
      group.fetchDataAt ORG_TOKEN, (err, token) ->
        return redirect()  if err or token

        scope = TEAM_SCOPE
        cc = kd.singletons.computeController
        cc.ui.askFor 'enableTeamOAuth', { scope }, (status) ->
          if status.cancelled
            toggle.setOff no
            loader.hide()
          else
            options.scope = scope  if status.confirmed
            redirect()
