 
         callback null, url
 
-
-    }[provider]?()
+    }[provider] ? -> callback new KodingError 'No such provider')()
 
 
-  @getUrl = secure (client, options, callback) ->
+  @getUrl = secure (client, urlOptions, callback) ->
 
-    { provider } = options
+    { provider } = urlOptions
 
     if redirectUri = KONFIG[provider].redirectUri or KONFIG[provider].redirect_uri
       redirectUri  = @prependGroupName redirectUri, client.context.group



  @saveTokens = (client, provider, credentials, callback) ->
    JSession.one { clientId: client.sessionToken }, (err, session) ->
      return callback err  if err
      return callback new KodingError 'Session not found'  unless session


      gitlab: ->

        { returnUrl } = urlOptions
        { applicationId, host, port } = KONFIG.gitlab
        host ?= 'gitlab.com'
        protocol = '//'
        port = if port then ":#{port}" else ''
        host = urlOptions.host ? host
        redirectUri = "#{redirectUri}?returnUrl=#{returnUrl}"  if returnUrl
        url = "#{protocol}#{host}#{port}/oauth/authorize?client_id=#{applicationId}&redirect_uri=#{redirectUri}&response_type=code"

