diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index 94d59180e15dd8c495f33eb9a2deb7890f8a207d..0056eb3a28beca716a38813c29f9370bdce5d4cf 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -67,7 +67,9 @@ module Gitlab
         end
 
         def uid
-          auth.info.uid || auth.uid
+          uid = auth.info.uid || auth.uid
+          uid = uid.to_s unless uid.nil?
+          uid
         end
 
         def email