2017 © Pedro Peláez
 

library auth0-php

Auth0 PHP SDK.

image

auth0/auth0-php

Auth0 PHP SDK.

  • Thursday, July 26, 2018
  • by iaco
  • Repository
  • 81 Watchers
  • 138 Stars
  • 504,038 Installations
  • PHP
  • 26 Dependents
  • 0 Suggesters
  • 92 Forks
  • 9 Open issues
  • 93 Versions
  • 17 % Grown

The README.md

auth0-php, (*1)

PHP SDK for Auth0 Authentication and Management APIs., (*2)

Package Build Status Coverage License, (*3)

:books: Documentation - :rocket: Getting Started - :computer: API Reference :speech_balloon: Feedback, (*4)

Documentation

We also have tailored SDKs for Laravel, Symfony, and WordPress. If you are using one of these frameworks, use the tailored SDK for the best integration experience., (*5)

Getting Started

Requirements

Please review our support policy for details on our PHP version support., (*6)

Installation

Ensure you have the necessary dependencies installed, then add the SDK to your application using Composer:, (*7)

composer require auth0/auth0-php --no-dev

Configure Auth0

Create a Regular Web Application in the Auth0 Dashboard. Verify that the "Token Endpoint Authentication Method" is set to POST., (*8)

Next, configure the callback and logout URLs for your application under the "Application URIs" section of the "Settings" page:, (*9)

  • Allowed Callback URLs: The URL of your application where Auth0 will redirect to during authentication, e.g., http://localhost:3000/callback.
  • Allowed Logout URLs: The URL of your application where Auth0 will redirect to after user logout, e.g., http://localhost:3000/login.

Note the Domain, Client ID, and Client Secret. These values will be used later., (*10)

Add login to your application

Create a SdkConfiguration instance configured with your Auth0 domain and Auth0 application client ID and secret. Generate a sufficiently long, random string for your cookieSecret using openssl rand -hex 32. Create a new Auth0 instance and pass your configuration to it., (*11)

use Auth0\SDK\Auth0;
use Auth0\SDK\Configuration\SdkConfiguration;

$configuration = new SdkConfiguration(
    domain: 'Your Auth0 domain',
    clientId: 'Your Auth0 application client ID',
    clientSecret: 'Your Auth0 application client secret',
    cookieSecret: 'Your generated string',
);

$auth0 = new Auth0($configuration);

Use the getCredentials() method to check if a user is authenticated., (*12)

// getCredentials() returns null if the user is not authenticated.
$session = $auth0->getCredentials();

if (null === $session || $session->accessTokenExpired) {
    // Redirect to Auth0 to authenticate the user.
    header('Location: ' . $auth0->login());
    exit;
}

Complete the authentication flow and obtain the tokens by calling exchange():, (*13)

if (null !== $auth0->getExchangeParameters()) {
    $auth0->exchange();
}

Finally, you can use getCredentials()?->user to retrieve information about our authenticated user:, (*14)

print_r($auth0->getCredentials()?->user);

That's it! You have successfully authenticated your first user with Auth0! From here, you may want to try following along with one of our quickstarts or browse through our examples for additional insight and guidance., (*15)

If you have questions, the Auth0 Community is a fantastic resource to ask questions and get help., (*16)

Input from Untrusted Sources

If your application accepts input from untrusted sources (such as query parameters from HTTP requests) please ensure you are following best practices for data validation and sanitization. It is your application's responsibility to ensure any data provided to the SDK is valid and safe. For more information, see the OWASP Data Validation Cheat Sheet., (*17)

API Reference

Support Policy

Our support lifecycle mirrors the PHP release support schedule., (*18)

SDK Version PHP Version Support Ends
8 8.3 Dec 2027
8.2 Dec 2026
8.1 Dec 2025

We drop support for PHP versions when they reach end-of-life and cease receiving security fixes from the PHP Foundation. Please ensure your environment remains up to date so you can continue receiving updates for PHP and this SDK., (*19)

Feedback

Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:, (*20)

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker., (*21)

Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues., (*22)


Auth0 Logo , (*23)

Auth0 is an easy-to-implement, adaptable authentication and authorization platform.
To learn more, check out "Why Auth0?", (*24)

This project is licensed under the MIT license. See the LICENSE file for more info., (*25)

The Versions

26/07 2018

dev-add-return-request-object

dev-add-return-request-object https://github.com/auth0/auth0-PHP

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

11/07 2018

dev-add-pagination-res-servers

dev-add-pagination-res-servers https://github.com/auth0/auth0-PHP

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/07 2018
03/07 2018
13/06 2018

5.2.0

5.2.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/05 2018

dev-add-email-template-endpoints

dev-add-email-template-endpoints

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2018

dev-fix-readme

dev-fix-readme

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/04 2018

5.1.1

5.1.1.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/03 2018

dev-5.x.x-dev

dev-5.x.x-dev

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/03 2018

dev-add-resource-servers-getall

dev-add-resource-servers-getall

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

20/03 2018

dev-fix-sessionstatehandler-type-hinting

dev-fix-sessionstatehandler-type-hinting

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

02/03 2018

dev-release-5.1.0

dev-release-5.1.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

02/03 2018

5.1.0

5.1.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

02/03 2018

dev-fixed-minor-code-quality-issues

dev-fixed-minor-code-quality-issues

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

24/11 2017

dev-release-5.0.6

dev-release-5.0.6

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

24/11 2017

5.0.6

5.0.6.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/11 2017

dev-added-support-state-validation

dev-added-support-state-validation

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

30/08 2017

5.0.5

5.0.5.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

24/07 2017
26/06 2017

5.0.4

5.0.4.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

16/03 2017
23/02 2017
22/02 2017
22/02 2017
01/12 2016

dev-revert-118-master

dev-revert-118-master

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/10 2016

dev-0.6.x-dev

dev-0.6.x-dev

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

06/10 2016

0.6.8

0.6.8.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

05/10 2016

0.6.7

0.6.7.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

12/08 2016

dev-3.x.x-dev

dev-3.x.x-dev

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/06 2016

dev-non-composer-troubleshooting

dev-non-composer-troubleshooting

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/05 2016

dev-2.x.x-dev

dev-2.x.x-dev

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/05 2016

2.2.3

2.2.3.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/05 2016

2.2.2

2.2.2.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2016

2.2.1

2.2.1.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/04 2016

2.2.0

2.2.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/01 2016

dev-1.x.x-dev

dev-1.x.x-dev

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/01 2016

1.0.11

1.0.11.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

14/01 2016

2.1.2

2.1.2.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/11 2015

2.1.1

2.1.1.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

24/11 2015

2.1.0

2.1.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

23/11 2015

2.0.0

2.0.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

23/09 2015

1.0.10

1.0.10.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

03/08 2015

1.0.9

1.0.9.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

27/07 2015

1.0.8

1.0.8.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

17/07 2015

1.0.7

1.0.7.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/06 2015

1.0.6

1.0.6.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

02/06 2015

1.0.5

1.0.5.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/05 2015

1.0.4

1.0.4.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/05 2015

1.0.3

1.0.3.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

13/05 2015

1.0.2

1.0.2.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2015

1.0.1

1.0.1.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/05 2015

1.0.0

1.0.0.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

The Development Requires

14/04 2014

0.6.6

0.6.6.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

03/04 2014

0.6.5

0.6.5.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

14/02 2014

0.6.4

0.6.4.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires

 

06/01 2014

0.6.3

0.6.3.0

Auth0 PHP SDK.

  Sources   Download

MIT

The Requires