PHPackages                             almajal/auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. almajal/auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

almajal/auth
============

.

019PHP

Since Apr 2Pushed 8y agoCompare

[ Source](https://github.com/nilesolutions/cognito-0auth-php)[ Packagist](https://packagist.org/packages/almajal/auth)[ RSS](/packages/almajal-auth/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP cognito 0AUTH 2
===================

[](#php-cognito-0auth-2)

Requirements
------------

[](#requirements)

The following versions of PHP are supported:

- PHP 5.6
- PHP 7.1
- PHP 7.2

Installation
------------

[](#installation)

```
composer require almajal/auth

```

how to use
----------

[](#how-to-use)

```
error_reporting(E_ALL);
ini_set('display_errors', 'On');

require 'vendor/autoload.php';

use Almajal\Auth\CognitoAuth;

// TESTING
CognitoAuth::config([
		'endPoint'      => 'https://yourdomain.auth.eu-central-1.amazoncognito.com/',
		'clientId'      => 'your client id',
		'clientSecret'  => 'your client secret',
		'redirectUri'   => 'https://test.localhost/',
    ]);

if  ( isset ( $_GET['code'] ) ){

	try {

		$getIdToken = CognitoAuth::getInstance()->getTokensByCode($_GET['code'])->getIdToken(true);
		PRINT ( $getIdToken );
		// do your stuff here

	}
	catch (exception $e)
	{
		echo $e->getMessage();
	 }
}
else{

	echo '
