Protected oauth methods
This commit is contained in:
parent
7301923bba
commit
563ae10217
28 changed files with 28 additions and 28 deletions
|
@ -64,7 +64,7 @@ abstract class OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
abstract public function getTokens(string $code):array;
|
abstract protected function getTokens(string $code):array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $refreshToken
|
* @param string $refreshToken
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Amazon extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8'];
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Apple extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Bitbucket extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
// Required as per Bitbucket Spec.
|
// Required as per Bitbucket Spec.
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Bitly extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Box extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Discord extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Dropbox extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Facebook extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Github extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Gitlab extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Google extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Linkedin extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Microsoft extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Mock extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Notion extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Authorization: Basic ' . \base64_encode($this->appID . ':' . $this->appSecret)];
|
$headers = ['Authorization: Basic ' . \base64_encode($this->appID . ':' . $this->appSecret)];
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Paypal extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Salesforce extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = [
|
$headers = [
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Slack extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
// https://api.slack.com/docs/oauth#step_3_-_exchanging_a_verification_code_for_an_access_token
|
// https://api.slack.com/docs/oauth#step_3_-_exchanging_a_verification_code_for_an_access_token
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Spotify extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Authorization: Basic ' . \base64_encode($this->appID . ':' . $this->appSecret)];
|
$headers = ['Authorization: Basic ' . \base64_encode($this->appID . ':' . $this->appSecret)];
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Stripe extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Tradeshift extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Twitch extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Vk extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8'];
|
||||||
|
|
|
@ -53,7 +53,7 @@ class WordPress extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$this->tokens = \json_decode($this->request(
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Yahoo extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = [
|
$headers = [
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Yammer extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
$headers = ['Content-Type: application/x-www-form-urlencoded'];
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Yandex extends OAuth2
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$headers = [
|
$headers = [
|
||||||
|
|
Loading…
Reference in a new issue