Skip to content

Commit 518d092

Browse files
committed
Bump version to 3.4.1
Release includes: - Return HTTP 409 instead of HTTP 500 for email collision in `/convert-token`. - Introduced `_is_email_already_exists` helper for unique-email checks. - Added optional `ACTIVATE_JWT` config for JWT activation via AppConfig. - Adjusted `InvalidateSessions` and `InvalidateRefreshTokens` responses to omit `Content-Type` header on HTTP 204.
1 parent 503519a commit 518d092

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
Change log
22
==========
33

4+
3.4.1 - 2026-04-26
5+
------------------
6+
7+
## What's Changed
8+
* Return ``HTTP 409 Conflict`` instead of ``HTTP 500`` when ``/convert-token`` collides with an existing local user that shares the same email as the social account (`#57 <https://github.com/wagnerdelima/drf-social-oauth2/issues/57>`_).
9+
10+
* New ``drf_social_oauth2.views._is_email_already_exists`` helper detects unique-email-constraint violations across PostgreSQL, MySQL, and SQLite, and walks the exception chain so it still matches when an ``IntegrityError`` is wrapped in a ``TransactionManagementError`` by a surrounding atomic block.
11+
* ``ConvertTokenView`` now catches both ``IntegrityError`` and ``TransactionManagementError`` and returns a structured body the frontend can dispatch on:
12+
13+
.. code-block:: json
14+
15+
{
16+
"code": "email_already_exists",
17+
"detail": "A user with this email already exists for a different authentication method.",
18+
"backend": "google-oauth2"
19+
}
20+
21+
* Recommended companion config: add ``social_core.pipeline.social_auth.associate_by_email`` to ``SOCIAL_AUTH_PIPELINE`` (before ``create_user``) so the duplicate-email path *associates* the social identity with the existing local user rather than throwing. Only enable this for backends that verify email ownership (e.g. Google, Facebook).
22+
* Move JWT activation logic out of ``settings.py`` and into a new ``DRFSocialOauth2Config.ready()`` AppConfig hook, so the activation runs once after Django is fully initialized. Opt in by setting ``ACTIVATE_JWT = True`` in your project settings; see the installation docs for the response shape and caveats.
23+
* ``InvalidateSessions`` and ``InvalidateRefreshTokens`` no longer emit a ``Content-Type`` header on their ``HTTP 204 No Content`` responses (empty dict removed from the ``Response`` call).
24+
425
3.3.0 - 2026-04-26
526
------------------
627

drf_social_oauth2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from secrets import SystemRandom
1111
from typing import Any
1212

13-
__version__ = '3.3.0'
13+
__version__ = '3.4.1'
1414

1515
__all__ = [
1616
'__version__',

0 commit comments

Comments
 (0)