diff --git a/sites/all/modules/contrib/fontyourface/modules/fontdeck/fontdeck.module b/sites/all/modules/contrib/fontyourface/modules/fontdeck/fontdeck.module
index ccb8230..fb68c8b 100644
--- a/sites/all/modules/contrib/fontyourface/modules/fontdeck/fontdeck.module
+++ b/sites/all/modules/contrib/fontyourface/modules/fontdeck/fontdeck.module
@@ -24,7 +24,7 @@ function fontdeck_fontyourface_import() {
 
   $success = TRUE;
   $project = variable_get('fontdeck_project', '');
-  $domain = preg_replace('#^www.#', '', $_SERVER['HTTP_HOST']);
+  $domain = fontdeck_get_domain();
 
   $project_info_url = FONTDECK_BASE_URL . 'project-info?project=' . $project . '&domain=' . $domain;
 
@@ -179,7 +179,7 @@ function fontdeck_fontyourface_preview($font, $text = NULL, $size = 18) {
 function fontdeck_preprocess_page(&$vars) {
 
   $project = variable_get('fontdeck_project', '');
-  $domain = preg_replace('#^www.#', '', $_SERVER['HTTP_HOST']);
+  $domain = fontdeck_get_domain();
 
   if (!empty($vars['fontyourface']) && $project != '') {
 
@@ -208,3 +208,13 @@ function fontdeck_preprocess_page(&$vars) {
   } // if
 
 } // fontdeck_preprocess_page
+
+
+/**
+ * Get the correct domain for authentication with fontdeck.
+ */
+function fontdeck_get_domain() {
+  $domain = parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST);
+  $domain = preg_replace('#^www.#', '', $domain);
+  return $domain;
+}
