Download the PHP package libinkk/oneauth without Composer

On this page you can find all versions of the php package libinkk/oneauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oneauth

OneAuth

Latest Stable Version Total Downloads PHP Version

OneAuth is a modular, API-first authentication package for Laravel 9, 10, 11, 12, and 13.

It provides one public API for session authentication, Laravel Sanctum, JWT access and refresh tokens, email OTP and OTP login, anonymous login, email verification, password management with history and expiration, two-factor authentication (TOTP, email OTP, SMS OTP with a custom provider), social login via Socialite, session tracking, device tracking with trusted-device policies, account locks, IP and country access rules, suspicious-login events, and audit logs.

OneAuth does not install a frontend, modify your User model, or force one authentication driver. Your Laravel application controls its UI, guards, User model, mail transport, and external providers.

[!IMPORTANT] OneAuth 1.x is under active development. Read Current implementation status before using it in production. SMS and WhatsApp delivery remain extension stubs until you bind real providers.

Contents

Why OneAuth

Laravel applications often combine multiple packages for session login, Sanctum, JWT, OTP, social login, verification, password reset, and 2FA. OneAuth organizes these concerns behind:

Features

Available in the package

Integration required

Not included

Requirements

The actual PHP requirement also depends on your Laravel major version. Composer resolves the compatible PHP and Illuminate dependency set.

Installation

Install the package:

Publish configuration and migrations:

Run migrations:

You can install and migrate in one command:

The install process is safe to run again:

Use --force only when you intentionally want to overwrite published files:

Check your installation:

The doctor command reports every OneAuth table as [exists] or [missing] and exits with a failure code when a table is missing.

Application setup

User model

OneAuth does not edit your User model. Your configured model must:

Example:

The HasOneAuth trait is optional. It provides:

Use a different model through .env:

Identifier fields

The default identifier fields are:

Remove fields your users table does not contain. If your database has no username or phone column, leaving these defaults can produce SQL errors during login lookup.

Mail

Email OTP, verification, and password reset need a configured Laravel mail transport:

Routes

OneAuth routes are enabled by default under /oneauth.

Disable package routes when using only the facade or your own controllers:

Authentication drivers

Choose one driver:

Supported values are session, sanctum, and jwt.

Session driver

The session driver uses Laravel's configured Auth guard:

The default package route middleware is api, which usually does not start a session. For session-based HTTP authentication, publish the config and change:

For SPA setups, configure Laravel's session cookies, CSRF protection, stateful domains, and CORS for your application.

Sanctum driver

Install Sanctum:

Add HasApiTokens to your User model:

Select the driver:

Login returns a Sanctum plain-text token:

Your application must configure Sanctum middleware or guards so Bearer tokens populate Laravel's current Auth user on protected requests.

JWT driver

firebase/php-jwt is installed with OneAuth. Configure a dedicated secret:

Generate a secret:

JWT login returns:

Refresh the token pair:

Refresh tokens are stored as SHA-256 hashes and rotated after use.

[!NOTE] OneAuth issues and rotates JWTs, authenticates Bearer access tokens in oneauth.auth, and revokes refresh tokens plus recently issued access tokens on logout and credential revoke.

Facade API tutorial

Import the facade:

Register

Registration does not automatically log in the user.

The default password policy requires:

Login

Login with email:

Login with username:

Login with phone:

You can also use the generic identifier key:

The result shape is driver-dependent:

OTP login

Send a login OTP (guest or authenticated):

Verify the code and establish the active driver session or tokens:

Verify without logging in (sets session flag when a session exists):

Anonymous login

Requires ONEAUTH_ANONYMOUS_LOGIN=true:

Current user

Logout

Refresh

For JWT, the current request must contain refresh_token.

Email verification

Password management

Two-factor authentication

Social login

Supported provider names: google, apple, github, facebook, microsoft, linkedin, twitter, discord.

Sessions and devices

Account lock helpers

Select a driver at runtime

Driver contract methods:

Prefer OneAuth::login() for application flows. It runs the shared login pipeline (rate limits, locks, access policy, verified email, 2FA, devices, sessions) before the driver establishes credentials.

HTTP API tutorial

All package endpoints return JSON. The default base path is:

Send these headers:

Public endpoints

Method Endpoint Purpose
POST /oneauth/register Register a user
POST /oneauth/login Authenticate credentials
POST /oneauth/login/otp Verify a login OTP and authenticate
POST /oneauth/login/anonymous Create and authenticate a guest user (opt-in)
POST /oneauth/refresh Refresh driver credentials (JWT refresh token)
POST /oneauth/social/{provider}/login Authenticate with a Socialite provider token
POST /oneauth/2fa/challenge Complete login after a 2FA challenge token
GET /oneauth/email/verify/signed Process a temporary signed verification URL
POST /oneauth/password/forgot Send a Laravel password reset link
POST /oneauth/password/reset Reset a password with broker token
POST /oneauth/otp/send Send an OTP (guest or authenticated; resolve user by identifier)
POST /oneauth/otp/verify Verify an OTP without establishing login

Protected endpoints

These routes use oneauth.auth:

Method Endpoint Purpose
POST /oneauth/logout Log out
GET /oneauth/user Return current user
POST /oneauth/email/send-verification Send verification token and link
POST /oneauth/email/verify Verify email token
POST /oneauth/2fa/enable Start 2FA setup (totp, email, or sms)
POST /oneauth/2fa/verify Confirm setup or verify a code for the session
POST /oneauth/2fa/disable Disable 2FA (requires password or 2FA code)
GET /oneauth/sessions List tracked sessions
DELETE /oneauth/sessions/{sessionId} Revoke one tracked session
POST /oneauth/sessions/logout-others Revoke all sessions except the current one
GET /oneauth/devices List tracked devices
POST /oneauth/devices/{fingerprint}/trust Mark a device trusted or untrusted
POST /oneauth/password/change Change current password

Register request

Login request

OTP login request

Anonymous login request

Requires ONEAUTH_ANONYMOUS_LOGIN=true.

Current user request

The Authorization header works only after your selected guard or custom middleware authenticates the token into Laravel Auth.

OTP authentication

The default provider sends OTP codes through Laravel Mail.

Send an OTP with the facade. Authenticated users can omit the identifier. Guests can send a login OTP by email, username, or phone:

Verify an OTP:

Complete an OTP login (verifies the code and establishes the configured driver session or tokens):

HTTP requests:

OTP security behavior:

Custom SMS or WhatsApp provider

The built-in SMS and WhatsApp provider classes are stubs. Bind your own implementation of OTPProviderInterface:

Register it in an application service provider:

The configured ONEAUTH_OTP_PROVIDER selects the bound package provider. The channel request field does not dynamically replace the container binding.

Email verification

Send a verification message:

The response contains:

Verify a token:

The package:

Require email verification during login:

[!NOTE] Guest verification with a token is supported through OneAuth::verifyEmail and the signed URL route. Authenticated users can also request a fresh verification email.

Password management

Forgot password

This delegates to Laravel's configured password broker.

Reset password

Change password

Password resets and changes record the resulting hash in oneauth_password_history, reject reuse against the configured history_limit, prune older history rows, and revoke OneAuth sessions plus Sanctum/JWT credentials.

Facade helpers:

Set password_policy.require_symbol to true when symbol characters are required.

Optional password expiration (days since last recorded password change; 0 disables):

Expired passwords block login until the user resets or changes their password.

Two-factor authentication

Enable TOTP 2FA (stores a pending secret until confirmed):

Enable email OTP 2FA (sends a confirmation OTP; SMS needs a custom OTP provider):

The TOTP setup result returns the secret and plaintext recovery codes once:

Render a QR code from otpauth_uri in your application UI. Secrets are RFC 4648 base32 for authenticator-app compatibility.

Confirm setup with a package TOTP or email/SMS OTP code (this sets enabled and fires TwoFactorEnabled):

Verify and consume a recovery code:

Disable 2FA (requires current password or a valid TOTP/recovery code):

The encrypted secret and recovery codes are cleared when disabled.

When login requires 2FA, OneAuth throws TwoFactorRequiredException with a short-lived challenge_token. Complete the login:

HTTP login returns 403 with two_factor_required and challenge_token. Finish with POST /oneauth/2fa/challenge.

Skip 2FA on trusted devices when enabled:

Mark a device trusted after login with OneAuth::trustDevice($fingerprint) or POST /oneauth/devices/{fingerprint}/trust.

[!WARNING] Pending 2FA secrets created before v1.2 used a package-specific secret format. Re-enable 2FA after upgrading if an older pending setup cannot be confirmed in an authenticator app.

Social authentication

Install Socialite:

Configure credentials in config/services.php.

Google example:

Environment:

Exchange a provider access token:

HTTP:

Supported provider names (configure Socialite + config/services.php for each):

Providers are resolved from oneauth.social.providers through a shared Socialite adapter.

The social flow:

  1. Resolves the remote user through Socialite userFromToken
  2. Finds an existing oneauth_social_accounts link
  3. Optionally links a verified email match when social.link_by_email is true (default false)
  4. Creates a user when social.create_user_if_missing is true and no conflicting email exists
  5. Links the provider account
  6. Dispatches SocialLogin
  7. Runs the shared login pipeline (verified-email gate, 2FA challenge, then establish for the active driver)

Apple may require a compatible Socialite provider adapter and Laravel event registration because Apple is not included in every Socialite installation.

Sessions and devices

Every successful login records:

List sessions:

List devices:

HTTP:

Session records use ONEAUTH_IDLE_TIMEOUT for their expiry timestamp.

Device fingerprints and IP data are signals only. Do not treat them as proof of identity.

Device rows store parsed browser, OS, and device name when oneauth.devices.parse_user_agent is true. Trust a device:

Revoke a session or other devices:

Anonymous login

Opt-in guest accounts (disabled by default):

Security controls

After too many failed attempts OneAuth creates a row in oneauth_account_locks. Manual helpers:

New-device logins dispatch SuspiciousLoginDetected when detection is enabled. Password expiration:

Set to 0 to disable.

Middleware

OneAuth registers:

Alias Behavior
oneauth.auth Requires the selected driver to report an authenticated Laravel user
oneauth.verified Requires an authenticated user with a populated email_verified_at
oneauth.otp Requires oneauth.otp_verified in the session
oneauth.twofactor Requires oneauth.twofactor_verified in the session

Apply middleware to application routes:

OTP and two-factor middleware currently use session flags. They are not token-scoped for pure JWT APIs.

Events

Listen to OneAuth events in your application:

Dispatched events:

All event objects expose:

Do not place tokens, OTP codes, passwords, recovery codes, or provider secrets in event context.

Configuration reference

Publish configuration:

Available environment variables:

Values in seconds:

Values in minutes:

The full PHP configuration is in config/oneauth.php.

Database tables

OneAuth uses morph columns instead of a foreign key to a specific users table.

Table Purpose
oneauth_otps Hashed OTP challenges, attempts, and expiration
oneauth_devices Device metadata and fingerprint
oneauth_sessions Tracked application sessions
oneauth_social_accounts OAuth provider account links
oneauth_email_verifications Hashed email verification tokens
oneauth_two_factor Encrypted 2FA secret and hashed recovery codes
oneauth_login_attempts Successful and failed login attempts
oneauth_password_history Historical password hashes
oneauth_refresh_tokens Hashed JWT refresh tokens
oneauth_audit_logs Authentication and security audit events
oneauth_account_locks Persistent identifier locks after brute-force or manual lock

Migrations are safe to run more than once because each migration checks Schema::hasTable() before creating its table.

Extension points

OneAuth provides these contracts:

Override a binding in your application service provider:

Custom authentication driver

Implement:

The current manager resolves only the built-in names session, sanctum, and jwt. To add a named driver, extend or replace OneAuthManager in the container.

NotificationProviderInterface defaults to the email implementation. SMS remains a stub until you bind a real provider.

Artisan commands

Install

Publish

Diagnose

Cleanup

Cleanup deletes:

Schedule cleanup in routes/console.php or your console kernel:

For older Laravel applications:

Testing

Install development dependencies:

Run tests:

On Windows:

The repository currently includes:

When contributing, add focused tests for every changed security flow and run the relevant Laravel compatibility matrix.

Security checklist

Before production use:

Never log:

Troubleshooting

Table already exists

OneAuth migrations skip tables that already exist. Run:

If a table exists with an incompatible schema, back it up and reconcile the schema manually. A table-name match does not validate its columns.

Table is missing

Session login does not persist

The default route middleware is api. Publish the config and change route middleware to web, or add your application session middleware.

Unauthenticated with a valid JWT

oneauth.auth accepts a Bearer JWT access token when the JWT driver (or a valid OneAuth JWT) is present. Confirm ONEAUTH_JWT_SECRET matches the issuing app and that the token has not expired.

Sanctum is not installed

Add HasApiTokens to the User model and complete Sanctum's installation.

Socialite is not installed

Then configure config/services.php.

SMS or WhatsApp OTP throws an exception

Those providers are extension stubs. Bind your own OTPProviderInterface implementation, switch oneauth.otp.provider to email, or run php artisan oneauth:doctor to confirm the configuration.

Current implementation status

The following details are important for honest production evaluation:

These notes are documented so developers can make an informed decision and contribute improvements.

Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Keep changes modular and driver-independent
  4. Add or update tests
  5. Run vendor/bin/phpunit
  6. Update documentation
  7. Open a pull request with a clear description and test plan

Contribution rules:

Repository:

https://github.com/libin-k-k/oneauth

Issues:

https://github.com/libin-k-k/oneauth/issues

Support

Please use GitHub Issues for reproducible bugs and feature requests. Do not post credentials, tokens, OTP codes, or private application data.

License

OneAuth is open-source software licensed under the MIT License.


All versions of oneauth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
firebase/php-jwt Version ^6.10
illuminate/auth Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/encryption Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/hashing Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/mail Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/notifications Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/validation Version ^9.0|^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package libinkk/oneauth contains the following files

Loading the files please wait ...