cognito / fast
使用 fast.co 快速登录
1.1.1
2021-01-08 06:55 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.0|^7.0
This package is auto-updated.
Last update: 2024-09-08 14:38:28 UTC
README
此包将您的自定义网站与https://fast.co登录系统集成
安装
使用composer安装非常简单
composer require cognito/fast
如果您没有composer,下载Fast.php文件并将其包含到您的项目中。
设置
首先,在https://fast.co注册账户并创建一个应用。这很简单。从应用详情中获取应用密钥和密钥。
集成
如果您更喜欢静态函数,有两个函数可以加快集成速度。
用于渲染登录按钮的函数
<?= \Cognito\Fast\Fast::quickLoginButton($fast_app_key) ?>
以及在fast带您去的回调URL上检查登录是否成功
<?php
if (\Cognito\Fast\Fast::quickLoginCheck($fast_app_key, $fast_secret_key)) {
// Allow the user to log on
} else {
// Do not allow log on
}
如果您不喜欢静态函数,类还提供了非静态方法。
例如
<?php
$fast = new \Cognito\Fast\Fast($fast_app_key, $fast_secret_key);
if (array_key_exists('challengeId', $_REQUEST)) {
// Check the login succeeded
if ($fast->loginCheck()) {
// Allow the user to log on
} else {
// Login failed
}
}
// Render the login button to the browser
echo $fast->loginButton();