package com.softwaremill.codebrag.service.github.jgit

import com.softwaremill.codebrag.service.github.{CommitReviewTaskGenerator, GitHubCommitImportService, GitHubCommitImportServiceFactory}
import com.softwaremill.codebrag.dao.{UserDAO, CommitInfoDAO}
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider

class JgitGitHubCommitImportServiceFactory(commitInfoDao: CommitInfoDAO, reviewTaskGenerator: CommitReviewTaskGenerator, userDao: UserDAO) extends GitHubCommitImportServiceFactory {

  def createInstance(email: String): GitHubCommitImportService = {
    val importingUserToken = userDao.findByEmail(email).get.authentication.token
    val credentials = new UsernamePasswordCredentialsProvider(importingUserToken, "")
    return new GitHubCommitImportService(new JgitGitHubCommitsLoader(new JgitFacade(credentials), new InternalGitDirTree, new JgitLogConverter), commitInfoDao, reviewTaskGenerator)
  }
}

package com.softwaremill.codebrag.service.github.jgit

import com.softwaremill.codebrag.service.github.{CommitReviewTaskGenerator, GitHubCommitImportService, GitHubCommitImportServiceFactory}
import com.softwaremill.codebrag.dao.{UserDAO, CommitInfoDAO}
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider

class JgitGitHubCommitImportServiceFactory(commitInfoDao: CommitInfoDAO, reviewTaskGenerator: CommitReviewTaskGenerator, userDao: UserDAO) extends GitHubCommitImportServiceFactory {

  def createInstance(email: String): GitHubCommitImportService = {
    val importingUserToken = userDao.findByEmail(email).get.token
    val credentials = new UsernamePasswordCredentialsProvider(importingUserToken, "")
    return new GitHubCommitImportService(new JgitGitHubCommitsLoader(new JgitFacade(credentials), new InternalGitDirTree, new JgitLogConverter), commitInfoDao, reviewTaskGenerator)
  }
}

--- 
+++ 
@@ -7,7 +7,7 @@
 class JgitGitHubCommitImportServiceFactory(commitInfoDao: CommitInfoDAO, reviewTaskGenerator: CommitReviewTaskGenerator, userDao: UserDAO) extends GitHubCommitImportServiceFactory {
 
   def createInstance(email: String): GitHubCommitImportService = {
-    val importingUserToken = userDao.findByEmail(email).get.token
+    val importingUserToken = userDao.findByEmail(email).get.authentication.token
     val credentials = new UsernamePasswordCredentialsProvider(importingUserToken, "")
     return new GitHubCommitImportService(new JgitGitHubCommitsLoader(new JgitFacade(credentials), new InternalGitDirTree, new JgitLogConverter), commitInfoDao, reviewTaskGenerator)
   }
Use correct field to load GitHub authorization token
