code: function authenticate (req, options) {
    var strategy = this
  
    // Handle the authorization response
    if (req.query && req.query.oauth_token) {
      if (!req.session['oauth']) {
        strategy.error(
          new Error('Failed to find request token in session')
        )
      }
  
      var authorization = req.query
      var secret = req.session['oauth'].oauth_token_secret
  
      // request token credentials
      strategy.tokenCredentials(authorization, secret, function (err, credentials) {
        if (err) { return strategy.error(err) }
  
        // clean up session
        delete req.session['oauth']
  
        // request user info
        strategy.userInfo(credentials, function (err, profile) {
          if (err) { return strategy.error(err) }
  
          // invoke the callback
          strategy.verify(req, credentials, profile, function (err, user, info) {
            if (err) { return strategy.error(err) }
            if (!user) { return strategy.fail(info) }
            strategy.success(user, info)
          })
        })
      })
  
    // Initiate the authorization flow
    } else {
      strategy.temporaryCredentials(function (err, response) {
        if (err || (!response && response.oauth_token)) {
          return strategy.error(
            new Error('Failed to obtain OAuth request token')
          )
        }
  
        // Store response in session
        if (!req.session['oauth']) { req.session['oauth'] = {} }
        req.session['oauth'].oauth_token = response.oauth_token
        req.session['oauth'].oauth_token_secret = response.oauth_token_secret
  
        // Redirect to OAuth server
        strategy.resourceOwnerAuthorization(response.oauth_token)
      })
    }
  }
docs: Authenticate