cmtz/ez-jwt

此包最新版本(dev-master)没有提供许可证信息。

ez-jwt 允许您为 Google API 上的 Server2Server 身份验证创建 JWT 令牌,并可修改以与其他 OAuth 服务一起工作

dev-master 2015-06-23 01:14 UTC

This package is not auto-updated.

Last update: 2024-10-02 09:21:20 UTC


README

简单的 OAuth 工具

## 安装 composer require cmtz/ez-jwt

## 如何使用 ez-jwt

#### 参数

$issuer = your@developer.gserviceaccount.com; //this would be the email issued via Google API console (Credentials)
$audience = "https://www.googleapis.com/oauth2/v3/token"; //for google jwt this is what would default
$scope = "https://www.googleapis.com/auth/content"; //for google jwt this is what would default
$key = file_get_contents(yourkeyfile.priv);
$algorithm = 'RS256'; //as of now only RS256 is supported using ez-jwt
$grant = 'urn:ietf:params:oauth:grant-type:jwt-bearer'; //for google jwt this is what would default
$APIurl = 'https://www.googleapis.com/oauth2/v3/token'; //for google jwt this is what would default
$headers = array('Content-Type' => 'application/x-www-form-urlencoded'); //this does not need to be set as it will default to what is needed but can be set to something else if needed

#### 调用 ezjwt

$token = ezjwt::generateToken($issuer, $audience, $scope, $key, $algorithm, $grant, $APIurl, $headers)