\App\Http\Controllers\OauthGithubController

Class GithubController

Summary

Methods
Properties
Constants
__construct()
getState()
checkState()
json()
error()
__getAccessToken()
getInstance()
getAuthUrl()
getAccessToken()
getUserInfo()
getUserRepos()
$state
No constants found
No protected methods found
$curl
$appid
$appsecret
$redirectUri
$instance
$apiUrl
N/A
No private methods found
No private properties found
N/A

Properties

$state

$state : string

Type

string

$curl

$curl : \Curl\Curl

Type

\Curl\Curl

$appid

$appid : string

Type

string

$appsecret

$appsecret : string

Type

string

$redirectUri

$redirectUri : string

Type

string

$instance

$instance : static

Type

static

$apiUrl

$apiUrl : string

Type

string — API 业务域名

Methods

__construct()

__construct(string  $appid, string  $appsecret) 

GithubController constructor.

Parameters

string $appid
string $appsecret

getState()

getState(integer  $length = 32) : string

TODO::获取状态值

Parameters

integer $length

Returns

string

checkState()

checkState(  $storeState,   $state) : boolean

TODO::校验标识是否正确

Parameters

$storeState
$state

Returns

boolean

json()

json(  $data) : mixed

TODO::数据转换成数组格式

Parameters

$data

Returns

mixed

error()

error(  $code,   $message) : array

TODO::获取错误信息

Parameters

$code
$message

Returns

array

__getAccessToken()

__getAccessToken(  $data) : array

Parameters

$data

Returns

array

getAuthUrl()

getAuthUrl(integer  $length = 32, string  $callback = '', string  $scope = 'user:email') : string

TODO::获取github授权页面

Parameters

integer $length
string $callback
string $scope

Returns

string

getAccessToken()

getAccessToken(string  $code, string  $state) : array|boolean|mixed

TODO::获取access_token

Parameters

string $code
string $state

Throws

\Exception

Returns

array|boolean|mixed

getUserInfo()

getUserInfo(string  $access_token) : mixed

TODO::获取用户信息

Parameters

string $access_token

Throws

\Exception

Returns

mixed

getUserRepos()

getUserRepos(string  $access_token) : mixed

TODO::获取用户信息(包含所有项目)

Parameters

string $access_token

Throws

\Exception

Returns

mixed