diff --git a/modules/authtwitter/default-disable b/modules/authtwitter/default-disable
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/modules/authtwitter/docs/authfacebook.txt b/modules/authtwitter/docs/authfacebook.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9336b9f762ac75e817e4ed11b4912a99729d81ba
--- /dev/null
+++ b/modules/authtwitter/docs/authfacebook.txt
@@ -0,0 +1,18 @@
+Using the Facebook authenticatio source with simpleSAMLphp
+==========================================================
+
+Remember to configure `authsources.php`, with both API key and secret.
+
+To get an API key and a secret, register the application at:
+
+ * <http://www.facebook.com/developers/>
+
+Set the callback URL to be:
+
+ * `http://idp.example.org/simplesaml/module.php/authfacebook/linkback.php?next=`
+
+Replace `idp.example.org` with your hostname.
+
+
+
+
diff --git a/modules/authtwitter/lib/Auth/Source/Twitter.php b/modules/authtwitter/lib/Auth/Source/Twitter.php
new file mode 100644
index 0000000000000000000000000000000000000000..9989082417dda4181127a8a08ce6ed61297e11c1
--- /dev/null
+++ b/modules/authtwitter/lib/Auth/Source/Twitter.php
@@ -0,0 +1,125 @@
+<?php
+
+/**
+ * Authenticate using Twitter.
+ *
+ * @author Andreas Ă…kre Solberg, UNINETT AS.
+ * @package simpleSAMLphp
+ * @version $Id$
+ */
+class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
+
+	/**
+	 * The string used to identify our states.
+	 */
+	const STAGE_INIT = 'twitter:init';
+
+	/**
+	 * The key of the AuthId field in the state.
+	 */
+	const AUTHID = 'twitter:AuthId';
+
+	private $key;
+	private $secret;
+
+
+	/**
+	 * Constructor for this authentication source.
+	 *
+	 * @param array $info  Information about this authentication source.
+	 * @param array $config  Configuration.
+	 */
+	public function __construct($info, $config) {
+		assert('is_array($info)');
+		assert('is_array($config)');
+
+		/* Call the parent constructor first, as required by the interface. */
+		parent::__construct($info, $config);
+
+		if (!array_key_exists('key', $config))
+			throw new Exception('Twitter authentication source is not properly configured: missing [key]');
+		
+		$this->key = $config['key'];
+		
+		if (!array_key_exists('secret', $config))
+			throw new Exception('Twitter authentication source is not properly configured: missing [secret]');
+
+		$this->secret = $config['secret'];
+
+		// require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/extlibinc/facebook.php');
+
+	}
+
+
+	/**
+	 * Log-in using Facebook platform
+	 *
+	 * @param array &$state  Information about the current authentication.
+	 */
+	public function authenticate(&$state) {
+		assert('is_array($state)');
+
+		/* We are going to need the authId in order to retrieve this authentication source later. */
+		$state[self::AUTHID] = $this->authId;
+		
+		$stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT);
+		
+		// SimpleSAML_Logger::debug('facebook auth state id = ' . $stateID);
+		
+		$consumer = new sspmod_oauth_Consumer($this->key, $this->secret);
+
+		// Get the request token
+		$requestToken = $consumer->getRequestToken('http://twitter.com/oauth/request_token');
+		SimpleSAML_Logger::debug("Got a request token from the OAuth service provider [" . 
+			$requestToken->key . "] with the secret [" . $requestToken->secret . "]");
+
+		$oauthState = array(
+			'requestToken' => $requestToken,
+			'stateid' => $stateID,
+		);
+		$session = SimpleSAML_Session::getInstance();
+		$session->setData('oauth', 'oauth', $oauthState);
+
+		// Authorize the request token
+		$consumer->getAuthorizeRequest('http://twitter.com/oauth/authenticate', $requestToken);
+
+	}
+	
+	
+	
+	public function finalStep(&$state) {
+		
+		$requestToken = $state['requestToken'];
+		
+		$consumer = new sspmod_oauth_Consumer($this->key, $this->secret);
+
+		// Replace the request token with an access token
+		$accessToken = $consumer->getAccessToken('http://twitter.com/oauth/access_token', $requestToken);
+		SimpleSAML_Logger::debug("Got an access token from the OAuth service provider [" . 
+			$accessToken->key . "] with the secret [" . $accessToken->secret . "]");
+
+		$userdata = $consumer->getUserInfo('http://twitter.com/account/verify_credentials.json', $accessToken);
+		
+		$attributes = array();
+		foreach($userdata AS $key => $value) {
+			if (is_string($value))
+				$attributes[$key] = array((string)$value);
+			
+		}
+		
+		if (array_key_exists('screen_name', $userdata) )
+			$attributes['eduPersonPrincipalName'] = array('@' . $userdata['screen_name']);
+		if (array_key_exists('name', $userdata) )
+			$attributes['displayName'] = array($userdata['name']);
+		if (array_key_exists('profile_image_url', $userdata) )
+			$attributes['jpegPhoto'] = array(base64_encode(file_get_contents($userdata['profile_image_url'])));
+		if (array_key_exists('url', $userdata) )
+			$attributes['labeledURI'] = array($userdata['url']);
+			
+		
+		$state['Attributes'] = $attributes;
+	}
+
+}
+
+?>
\ No newline at end of file
diff --git a/modules/authtwitter/www/linkback.php b/modules/authtwitter/www/linkback.php
new file mode 100644
index 0000000000000000000000000000000000000000..277d542225d8ea849ab7b7b5b2c840f5ece21e0b
--- /dev/null
+++ b/modules/authtwitter/www/linkback.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * Handle linkback() response from Twitter.
+ */
+sspmod_oauth_Consumer::dummy();
+
+// $config = SimpleSAML_Configuration::getInstance();
+$session = SimpleSAML_Session::getInstance();
+ 
+$oauthState = $session->getData('oauth', 'oauth');
+
+if (empty($oauthState)) throw new Exception('Could not load oauthstate');
+if (empty($oauthState['stateid'])) throw new Exception('Could not load oauthstate:stateid');
+
+
+$stateId = $oauthState['stateid'];
+
+// echo 'stateid is ' . $stateId;
+
+$state = SimpleSAML_Auth_State::loadState($stateId, sspmod_authtwitter_Auth_Source_Twitter::STAGE_INIT);
+$state['requestToken'] = $oauthState['requestToken'];
+
+/* Find authentication source. */
+assert('array_key_exists(sspmod_authtwitter_Auth_Source_Twitter::AUTHID, $state)');
+$sourceId = $state[sspmod_authtwitter_Auth_Source_Twitter::AUTHID];
+
+$source = SimpleSAML_Auth_Source::getById($sourceId);
+if ($source === NULL) {
+	throw new Exception('Could not find authentication source with id ' . $sourceId);
+}
+
+$config = SimpleSAML_Configuration::getInstance();
+
+$source->finalStep($state);
+
+SimpleSAML_Auth_Source::completeAuth($state);
+
+