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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.