How to do it...

Once you have a new project created or are working with the AuthCodeApp project that was created in the Creating an Android OAuth 2.0 client using an Authorization Code with the system browser recipe, you just have to perform the following steps to start adding support for PKCE to avoid Authorization Code interception. The complete source code for this recipe can also be download at https://github.com/PacktPublishing/OAuth-2.0-Cookbook/tree/master/Chapter07/.

  1. First of all, create the class PkceManager that will be in charge of generating the code challenge and to store the code verifier which must be bound to the code challenge. This class should be created inside the sub-package client/oauth2:
public class PkceManager { ...

Get OAuth 2.0 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.