   # 3. The API request to auth this account to the plugin failed. This may mean that
   #    the plugin server couldn't be reached or failed to respond properly when authing
   #    the account, or that the Nylas API couldn't be reached.
-  authPlugin: (pluginId, pluginName, account) ->
+  authPlugin: (pluginId, pluginName, accountId) ->
+    AccountStore = AccountStore || require './stores/account-store'
+    account = AccountStore.accountForId(accountId)
     return @makeRequest({
       returnsModel: false,
       method: "GET",

      )
    )

  unauthPlugin: (pluginId, account) ->
    return @makeRequest({
      returnsModel: false,
      method: "DELETE",
      accountId: account.id,
      path: "/auth/plugin?client_id=#{pluginId}"
    });


      if result.authed
        return Promise.resolve()
      else
        return @_requestPluginAuth(pluginName, account).then( => @makeRequest({
          returnsModel: false,
          method: "POST",
          accountId: account.id,
          path: "/auth/plugin",
          body: {client_id: pluginId},
          json: true
        }))
    )
