OAuth has become the de-facto standard to authenticate web API. In this talk we will present the OAuth2 framework, showing the different use cases and how to implement it in PHP, using Apigility. We will cover the following scenarios: web-server applications, browser-based applications, mobile apps, username and password access, application access. This talk has been presented at ZendCon 2014 in Santa Clara (California).