PHPackages                             tipbr/silverstripe-restfulserver-jwt-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. tipbr/silverstripe-restfulserver-jwt-auth

ActiveSilverstripe-vendormodule[Authentication &amp; Authorization](/categories/authentication)

tipbr/silverstripe-restfulserver-jwt-auth
=========================================

JWT Authentication for SilverStripe RestfulServer - provides secure API authentication with proper permission integration

06[1 PRs](https://github.com/tipbr/silverstripe-restfulserver-jwt-auth/pulls)PHP

Since Aug 27Pushed 7mo agoCompare

[ Source](https://github.com/tipbr/silverstripe-restfulserver-jwt-auth)[ Packagist](https://packagist.org/packages/tipbr/silverstripe-restfulserver-jwt-auth)[ RSS](/packages/tipbr-silverstripe-restfulserver-jwt-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

JWT Authentication for SilverStripe RestfulServer
=================================================

[](#jwt-authentication-for-silverstripe-restfulserver)

This module provides JWT (JSON Web Token) authentication for SilverStripe's RestfulServer module, enabling secure API access with proper permission integration.

Features
--------

[](#features)

- **JWT Token Authentication**: Secure API authentication using industry-standard JWT tokens
- **RestfulServer Integration**: Seamlessly integrates with SilverStripe's RestfulServer module
- **Permission Checking**: Respects DataObject `canView()`, `canEdit()`, `canDelete()`, and `canCreate()` methods
- **Automatic Token Renewal**: Tokens are automatically renewed when close to expiry
- **CORS Support**: Built-in CORS headers for cross-domain API access
- **Auth API Endpoints**: Login, logout, token refresh, password reset functionality

Quick Start
-----------

[](#quick-start)

### 1. Installation

[](#1-installation)

```
composer require tipbr/silverstripe-restfulserver-jwt-auth
```

### 2. Configuration

[](#2-configuration)

Set your JWT secret in your environment file:

```
# .env
JWT_SECRET=your-super-secret-jwt-key-here
```

The module comes pre-configured but you can customize settings in `_config.yml`:

```
# Configure JWT Service
Tipbr\Services\JWTService:
  lifetime: 604800      # 7 days in seconds
  renewal_threshold: 3600  # 1 hour in seconds
  algorithm: 'HS256'
```

### 3. Enable API Access on Your DataObjects

[](#3-enable-api-access-on-your-dataobjects)

```
