diff --git a/pygitweb/auth_config.py b/pygitweb/auth_config.py
index e550037..97398aa 100644
--- a/pygitweb/auth_config.py
+++ b/pygitweb/auth_config.py
@@ -94,7 +94,7 @@ class AuthConfig(BaseModel):
 	oauth_client_id: str = ""
 	oauth_client_secret: str = ""
 	oauth_redirect_uri: str = ""
-	oauth_username_from: OAuthUsernameFrom = "email"
+	oauth_username_from: OAuthUsernameFrom = "preffered_username"
 	oauth_allowed_emails: list[str] = Field(default_factory=list)
 	oauth_permissions: PermissionsMap = Field(default_factory=PermissionsMap.empty)
 	local_users: list[LocalUser] = Field(default_factory=list)
@@ -135,7 +135,7 @@ def default_auth_config(*, admin_password: str, salt: str) -> AuthConfig:
 		oauth_client_id="",
 		oauth_client_secret="",
 		oauth_redirect_uri="",
-		oauth_username_from="email",
+		oauth_username_from="preffered_username",
 		oauth_allowed_emails=[],
 		oauth_permissions=PermissionsMap.default_access(),
 		local_users=[LocalUser(user="admin", pass_hash=hash_password(admin_password, config_salt=salt))],
diff --git a/pygitweb/auth_oauth.py b/pygitweb/auth_oauth.py
index 5c283f9..d4a2b27 100644
--- a/pygitweb/auth_oauth.py
+++ b/pygitweb/auth_oauth.py
@@ -323,10 +323,9 @@ async def oauth_callback(
 	if not is_oauth_email_allowed(auth_config, email):
 		raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Email is not allowed to sign in")
 	username = oauth_username_from_profile(auth_config, profile)
-	subject = _profile_subject(profile)
 	sid = create_session(
 		username,
-		subject=subject,
+		subject=username,
 		email=email,
 		auth_method="oauth",
 	)
diff --git a/pygitweb/auth_test.py b/pygitweb/auth_test.py
index ab91ef4..070e5a8 100644
--- a/pygitweb/auth_test.py
+++ b/pygitweb/auth_test.py
@@ -371,15 +371,15 @@ def test_oauth_callback_creates_session(client: TestClient, oauth_auth_config: A
 		assert r.status_code == 303
 		rec = get_session(r.cookies["pygitweb_access_token"])
 		assert rec is not None
-		assert rec.username == "user@example.com"
-		assert rec.subject == "oauth-sub-1"
+		assert rec.username == "oauthuser"
+		assert rec.subject == "oauthuser"
 		assert rec.email == "user@example.com"
 		assert rec.auth_method == "oauth"
-		assert client.get("/users/me").json()["username"] == "user@example.com"
+		assert client.get("/users/me").json()["username"] == "oauthuser"
 		status = client.get("/auth/status").json()
-		assert status["username"] == "user@example.com"
+		assert status["username"] == "oauthuser"
 		assert status["gravatar_url"] == gravatar_url("user@example.com")
-	clear_client_cookies(client)
+		clear_client_cookies(client)
 
 
 def test_auth_status_no_gravatar_for_local_login(client: TestClient, local_auth_config: AuthConfig) -> None:
