   @extractOauthFromSession: (clientId, callback)->
     JSession.one {clientId: clientId}, (err, session)->
       return callback err  if err
+      return callback()    unless session
 
       {foreignAuth, foreignAuthType} = session
       if foreignAuth and foreignAuthType

    {sessionToken} = client
    JSession.one {clientId: sessionToken}, (err, session) =>
      return callback err  if err
      return callback createKodingError "No session"  unless session

      kallback = (err, resp={}) ->
        {account, replacementToken} = resp

    @extractOauthFromSession clientId, (err, foreignAuthInfo, session)=>
      return callback err  if err
      return callback()    unless foreignAuthInfo
      return callback()    unless session

      @saveOauthToUser foreignAuthInfo, username, (err)=>
        return callback err  if err
        @clearOauthFromSession session, (err)=>
