- Part 1 – Principles and Terminology
- Part 2 – Setting up OAuth2 with Symfony2 using FOSOAuthServerBundle
- Part 3 – Using OAuth2 with your bare hands
- Part 4 – Implementing Custom Grant Type
- Part 5 – Implementing OAuth2 Client with Symfony2
Intro
In this article I would like to describe implementation of an OAuth2 Client. Please keep in mind that this is not an authentification provider. To authenticate against third party services there are well maintained bundles that do just that. My target is to provide a solution to consume the API from the OAuth2 Server we provided in the previous articles.
Overview
For this implementation I had two options. To use lightweight OAuth2 client library or to implement Guzzle Plugin. I have chosen the first approach, since it covers several grants at once, when Guzzle plugin will solve the more specific problem, and might be a better solution in your specific case.
In this article I will focus on authorization_code and client_credentials grant types.