gooby/ez-auth-client
最新稳定版本:v1.1.0
Composer 安装命令:
composer require gooby/ez-auth-client
包简介
Client for using the gooby/ez-auth-server to enable SSO across multiple sub domains with JWTs.
README 文档
README
Used along side a EZ Auth Server to allow SSO across multiple subdomains sharing a TLD using JWTs.
Installation
Use composer to manage your dependencies and download EZ Auth Client:
composer require gooby/ez-auth-client
Setup
We recommend adding these to your .env file, otherwise, you can pass these settings in the Auth constructor.
EZ_AUTH_CLIENT_SECRET="my-shared-secret-here"
EZ_AUTH_CLIENT_SERVER="https://auth.my-ez-auth-server.com"
Quick Start
<?php $auth = new Gooby\EzAuthClient\Auth(); $user = $auth->getUserOrLogin(); echo "You're logged in and your ID is {$user->id}";
Example
<?php use Gooby\EzAuthClient\Auth; use Gooby\EzAuthClient\JwtDecodeException; $client = new Auth(); try { $user = $client->getUser(); } catch (JwtDecodeException $e) { // Invalid token, or bad secret MyApp::logFailedLoginAttempt('Invalid Token: ' . $e->getMessage()); // Redirect request to login page $client->login(); } echo "You're logged in and your ID is {$user->id}";
统计信息
- 总下载量: 1.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-22