 			'accept-language':req.headers['accept-language']
 			'content-type':req.headers['content-type']
 		for name, value of oauthrequest.headers
-			param = replace_param value, params, parameters.oauthio, parameters
+			param = @_replace_param value, params, parameters.oauthio, parameters
 			options.headers[name] = param if param
 
 		# build body

			options.qs = query

		# do request to request_token
		request options, (e, r, body) ->
			return callback(e) if e
			responseParser = new OAuth1ResponseParser(r, body, headers["Accept"], 'request_token')
			return callback(responseParser.error) if responseParser.error

			dbstates.setToken state.id, responseParser.oauth_token_secret, (e, r) ->
				return callback e if e
				authorize = provider.oauth1.authorize
				query = {}
				if typeof opts.options?.authorize == 'object'
					query = opts.options.authorize
				for name, value of authorize.query
					param = replace_param value, @_params, state:state.id, callback:config.host_url+config.relbase, parameters
					query[name] = param if param
				query.oauth_token = responseParser.oauth_token
				url = replace_param authorize.url, @_params, {}, parameters
				url += "?" + querystring.stringify query
				callback null, url

	access_token: (state, req, callback) ->
		if not req.params.oauth_token && not req.params.error

			options: opts.options,
			expire: 600
		dbstates.add data, (err, state) =>
			@_dbAddedCallback(err, state, provider, parameters, opts, callback)

	_dbAddedCallback: (err, state, provider, parameters, opts, callback) ->
		request_token = provider.oauth1.request_token
		query = {}
		if typeof opts.options?.request_token == 'object'
			query = opts.options.request_token
		for name, value of request_token.query
			param = @_replace_param value, @_params, state:state.id, callback:config.host_url+config.relbase, parameters
			query[name] = param if param
		headers = {}
		headers["Accept"] = short_formats[request_token.format] || request_token.format if request_token.format
		for name, value of request_token.headers
			param = @_replace_param value, @_params, {}, parameters
			headers[name] = param if param
		options =
			url: request_token.url
