Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Simple Oauth2 Client

Simple Oauth2 Client Laravel Package

raiolanetworks/simple-oauth2-client

Simple OAuth2 client for PHP and Laravel projects that streamlines authorization code flows, access token exchange, and refresh token handling. Lightweight and easy to configure, it helps integrate third-party OAuth providers and secure API authentication without boilerplate.

View on GitHub
Deep Wiki
Context7

This OAuth package for Laravel provides an easy and reusable solution for integrating OAuth authentication into your Laravel projects. It supports flexible user model configurations and works with any model implementing the Authenticatable interface, streamlining secure third-party logins.

Frequently asked questions about Simple Oauth2 Client
How do I install raiolanetworks/simple-oauth2-client in a Laravel app?
Install it with Composer, then let Laravel package auto-discovery register the service provider. Publish the config/oauth.php file if you need to customize settings, and run php artisan oauth:install to complete the package setup. After installation, verify the generated oauth.request and oauth.callback routes with route:list.
Which Laravel and PHP versions are supported by simple-oauth2-client 3.2.0?
The 3.2.0 release targets modern Laravel applications and its notes reference Laravel 11+ behavior such as TrustProxies defaults. Exact PHP and Laravel version constraints are defined in the package composer.json, so check those before upgrading. The package uses standard Laravel auto-discovery and should fit a current application without custom bootstrapping.
How is the OAuth redirect URI configured in simple-oauth2-client?
In 3.2.0 the advertised redirect URI is derived from APP_URL plus the resolved callback route path. This makes the package route the single source of truth for the callback path instead of relying on an independently configured OAUTH_CALLBACK_URI. Confirm the printed redirect URI against your OAuth provider and verify it with route:list.
What happened to OAUTH_CALLBACK_URI in version 3.2.0?
OAUTH_CALLBACK_URI may still appear in the published config file, but 3.2.0 no longer reads it to build the advertised redirect URI. The package now derives that URI from APP_URL and the callback route path. If you previously set a custom OAUTH_CALLBACK_URI, update your provider registration or set OAUTH_ROUTE_PREFIX to match, and watch for a silent redirect_uri mismatch.
What is OAUTH_ROUTE_PREFIX and can it contain nested segments like auth/sso?
OAUTH_ROUTE_PREFIX controls the path prefix for the package routes while keeping the route names oauth.request and oauth.callback stable. The default is oauth, so the callback path is normally /oauth/callback under APP_URL. The provided release notes do not confirm whether nested segments such as auth/sso are validated, so test route:list and route:cache before relying on them.
Does OAUTH_ROUTE_PREFIX work with Laravel route caching?
The release does not call out a route-cache incompatibility, and the package keeps stable route names for oauth.request and oauth.callback. After changing OAUTH_ROUTE_PREFIX, clear and rebuild Laravel's route cache and confirm the resulting paths with route:list. Also re-check the advertised redirect URI against the provider after any prefix change.
What does preserve_intended_url do in simple-oauth2-client?
preserve_intended_url defaults to true and reuses Laravel's intended-URL behavior so users can return to a stored deep link after authentication. Existing installs may previously have always landed on a fixed success route, so this is a behavior change worth reviewing. Set it to false if your post-login UX or redirect-validation assumptions require a fixed landing page.
Can I use a custom user model with this OAuth package?
Yes. The package supports flexible user model configurations and works with any model that implements Laravel's Authenticatable interface. That lets you map OAuth provider identities onto your own application user model instead of being locked to a specific implementation. Make sure your provider callback maps or creates users consistently.
Is simple-oauth2-client suitable for multi-tenant or multi-domain OAuth applications?
Deriving the redirect URI from APP_URL hard-codes a single canonical origin, which fits standard single-domain Laravel apps best. The provided notes do not document a supported per-request or per-tenant override of the redirect URI or prefix. Multi-domain or per-tenant provider apps may need separate deployments, separate provider apps, or custom handling.
How should I upgrade an existing Laravel app to simple-oauth2-client 3.2.0?
Bump the Composer dependency, optionally re-run php artisan oauth:install, and verify the printed redirect URI against your OAuth provider. Check route:list and confirm whether you had custom routes or a custom OAUTH_CALLBACK_URI that now need OAUTH_ROUTE_PREFIX adjustments. Review preserve_intended_url behavior and rebuild route cache before deploying.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo