django-next-auth-adapter


Namedjango-next-auth-adapter JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/mabdullahadeel/django-next-auth-adapter
SummaryA Django app to to handle server side requirests of next-auth-http-adapter
upload_time2023-09-17 22:24:11
maintainer
docs_urlNone
authorAbdullah Adeel
requires_python>=3.7
licenseMIT license
keywords django_next_auth_adapter django next-auth auth rest restframework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Next Auth Adapter

Django Next Auth Adapter is a Django package designed to handle server-side requests from the "next-auth-http-adapter" JavaScript package. This package is intended for use with Next.js and NextAuth.js to seamlessly integrate custom backend functionality into the NextAuth.js authentication flow by facilitating HTTP communication between the frontend and backend.

## Pre-requisites

### User Model

add the following to your user model

```python

class User(AbstractBaseUser):
    # ...
    email_verified = models.DateTimeField(blank=True, null=True)
    # ...
    EMAIL_FIELD = "email"
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['username']
    # ...

```

## Installation

You can install the package via pip:

```bash
pip install django-next-auth-adapter
```

## Configuration

To configure the Django Next Auth Adapter, you need to define certain settings in your Django project's settings module (`settings.py`).

Include `django_next_auth_adapter` in your `INSTALLED_APPS`:

```python
# settings.py

INSTALLED_APPS = [
    # Your other installed apps
    "django_next_auth_adapter",
]
```

For custom configuration, add the following settings to your `settings.py` file:

```python
# settings.py

DJANGO_NEXT_AUTH_ADAPTER = {
    # optional: specify the permission classes applied to views within the package. Customize these classes as needed to control access to your views. Do not specify this parameter if you want to use the default permission classes.
    "PERMISSION_CLASSES": [
        # Add your permission classes here
    ],
    # optional: specify the token used for authenticating requests from the next-auth server. If not provided, authentication will be bypassed.
    "REMOTE_AUTH_TOKEN": "your-remote-auth-token",
}
```

### Available Settings

-   **DJANGO_NEXT_AUTH_ADAPTER (dictionary):** The main configuration dictionary for the package.
    -   **PERMISSION_CLASSES (list):** This is a list of permission classes applied to views within the package. Customize these classes as needed to control access to your views.
    -   **REMOTE_AUTH_TOKEN (string, optional):** The token used by the default permission class for authenticating requests from the next-auth server. If not provided, authentication will be bypassed.

## Usage

To use the Django Next Auth Adapter, import it as follows:

```python
from django_next_auth_adapter import DjangoNextAuthAdapter
```

You can then use the imported classes and functions to handle authentication and authorization as needed within your Django views.

## Configuration in `urls.py`

To include the package's URLs in your Django project, follow these steps:

1. Open your project's base `urls.py` file.

2. Import the package's views and include them in your URL patterns.

```python
# urls.py

from django.urls import path, include
from django_next_auth_adapter.views import YourViewName1, YourViewName2  # Import your views here

urlpatterns = [
    # Your other URL patterns
    path('next-auth/', include('django_next_auth_adapter.urls')),  # Include the package's URLs here
]
```

## Signals

The package provides the following signals that you can use to customize the authentication and authorization process:

-   **user_created:** Sent when a new user is created. The signal sends the following arguments:
    -   **sender:** The serializer class.
    -   **user:** The user instance.
    -   **validated_data:** The validated data used to create the user.
    -   **image:** The image url of the user.
    -   **name:** The name of the user.
-   **user_updated:** Sent when a user is updated. The signal sends the following arguments:
    -   **sender:** The serializer class.
    -   **user:** The user instance.
    -   **validated_data:** The validated data used to create the user.
    -   **image:** The image url of the user.
    -   **name:** The name of the user.

## Links

-   [GitHub Repository](https://github.com/mabdullahadeel/django-next-auth-adapter)
-   [next-auth-http-adapter](https://github.com/mabdullahadeel/next-auth-http-adapter)

## License

This project is open source and is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mabdullahadeel/django-next-auth-adapter",
    "name": "django-next-auth-adapter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "django_next_auth_adapter,django,next-auth,auth,rest,restframework",
    "author": "Abdullah Adeel",
    "author_email": "contact.abdadeel@gamil.com",
    "download_url": "https://files.pythonhosted.org/packages/26/e8/e8af94c60ceaf8e3fa086732eb4d921401e557fc808eba5d43b17ea4ab6d/django-next-auth-adapter-0.0.4.tar.gz",
    "platform": null,
    "description": "# Django Next Auth Adapter\n\nDjango Next Auth Adapter is a Django package designed to handle server-side requests from the \"next-auth-http-adapter\" JavaScript package. This package is intended for use with Next.js and NextAuth.js to seamlessly integrate custom backend functionality into the NextAuth.js authentication flow by facilitating HTTP communication between the frontend and backend.\n\n## Pre-requisites\n\n### User Model\n\nadd the following to your user model\n\n```python\n\nclass User(AbstractBaseUser):\n    # ...\n    email_verified = models.DateTimeField(blank=True, null=True)\n    # ...\n    EMAIL_FIELD = \"email\"\n    USERNAME_FIELD = 'email'\n    REQUIRED_FIELDS = ['username']\n    # ...\n\n```\n\n## Installation\n\nYou can install the package via pip:\n\n```bash\npip install django-next-auth-adapter\n```\n\n## Configuration\n\nTo configure the Django Next Auth Adapter, you need to define certain settings in your Django project's settings module (`settings.py`).\n\nInclude `django_next_auth_adapter` in your `INSTALLED_APPS`:\n\n```python\n# settings.py\n\nINSTALLED_APPS = [\n    # Your other installed apps\n    \"django_next_auth_adapter\",\n]\n```\n\nFor custom configuration, add the following settings to your `settings.py` file:\n\n```python\n# settings.py\n\nDJANGO_NEXT_AUTH_ADAPTER = {\n    # optional: specify the permission classes applied to views within the package. Customize these classes as needed to control access to your views. Do not specify this parameter if you want to use the default permission classes.\n    \"PERMISSION_CLASSES\": [\n        # Add your permission classes here\n    ],\n    # optional: specify the token used for authenticating requests from the next-auth server. If not provided, authentication will be bypassed.\n    \"REMOTE_AUTH_TOKEN\": \"your-remote-auth-token\",\n}\n```\n\n### Available Settings\n\n-   **DJANGO_NEXT_AUTH_ADAPTER (dictionary):** The main configuration dictionary for the package.\n    -   **PERMISSION_CLASSES (list):** This is a list of permission classes applied to views within the package. Customize these classes as needed to control access to your views.\n    -   **REMOTE_AUTH_TOKEN (string, optional):** The token used by the default permission class for authenticating requests from the next-auth server. If not provided, authentication will be bypassed.\n\n## Usage\n\nTo use the Django Next Auth Adapter, import it as follows:\n\n```python\nfrom django_next_auth_adapter import DjangoNextAuthAdapter\n```\n\nYou can then use the imported classes and functions to handle authentication and authorization as needed within your Django views.\n\n## Configuration in `urls.py`\n\nTo include the package's URLs in your Django project, follow these steps:\n\n1. Open your project's base `urls.py` file.\n\n2. Import the package's views and include them in your URL patterns.\n\n```python\n# urls.py\n\nfrom django.urls import path, include\nfrom django_next_auth_adapter.views import YourViewName1, YourViewName2  # Import your views here\n\nurlpatterns = [\n    # Your other URL patterns\n    path('next-auth/', include('django_next_auth_adapter.urls')),  # Include the package's URLs here\n]\n```\n\n## Signals\n\nThe package provides the following signals that you can use to customize the authentication and authorization process:\n\n-   **user_created:** Sent when a new user is created. The signal sends the following arguments:\n    -   **sender:** The serializer class.\n    -   **user:** The user instance.\n    -   **validated_data:** The validated data used to create the user.\n    -   **image:** The image url of the user.\n    -   **name:** The name of the user.\n-   **user_updated:** Sent when a user is updated. The signal sends the following arguments:\n    -   **sender:** The serializer class.\n    -   **user:** The user instance.\n    -   **validated_data:** The validated data used to create the user.\n    -   **image:** The image url of the user.\n    -   **name:** The name of the user.\n\n## Links\n\n-   [GitHub Repository](https://github.com/mabdullahadeel/django-next-auth-adapter)\n-   [next-auth-http-adapter](https://github.com/mabdullahadeel/next-auth-http-adapter)\n\n## License\n\nThis project is open source and is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "A Django app to to handle server side requirests of next-auth-http-adapter",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/mabdullahadeel/django-next-auth-adapter"
    },
    "split_keywords": [
        "django_next_auth_adapter",
        "django",
        "next-auth",
        "auth",
        "rest",
        "restframework"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79f4dfd579e82c55ffe6d2a9b0aed2d8f2a4878afce2bcfdd3769ebb10b49a9e",
                "md5": "abc009aa819a7c102893a945ea4e6208",
                "sha256": "93dbf27c7d39fd1431ba08c68e5f3651d594a6173f980074a74fb4429151bc26"
            },
            "downloads": -1,
            "filename": "django_next_auth_adapter-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "abc009aa819a7c102893a945ea4e6208",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10563,
            "upload_time": "2023-09-17T22:24:09",
            "upload_time_iso_8601": "2023-09-17T22:24:09.542573Z",
            "url": "https://files.pythonhosted.org/packages/79/f4/dfd579e82c55ffe6d2a9b0aed2d8f2a4878afce2bcfdd3769ebb10b49a9e/django_next_auth_adapter-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26e8e8af94c60ceaf8e3fa086732eb4d921401e557fc808eba5d43b17ea4ab6d",
                "md5": "4f01ad02636901d697abb90c7584cfd3",
                "sha256": "d9f370a39e9563c5e4131fa14cc40726c787c2813ca35c662858123c58b21f89"
            },
            "downloads": -1,
            "filename": "django-next-auth-adapter-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "4f01ad02636901d697abb90c7584cfd3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9191,
            "upload_time": "2023-09-17T22:24:11",
            "upload_time_iso_8601": "2023-09-17T22:24:11.490000Z",
            "url": "https://files.pythonhosted.org/packages/26/e8/e8af94c60ceaf8e3fa086732eb4d921401e557fc808eba5d43b17ea4ab6d/django-next-auth-adapter-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-17 22:24:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mabdullahadeel",
    "github_project": "django-next-auth-adapter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-next-auth-adapter"
}
        
Elapsed time: 0.11513s