Callback Handlers
Learn how to create a callback handler with a code example.
We'll cover the following...
We'll cover the following...
We will continue working on the same OAuth2 example from the previous lesson.
Create a callback handler
Let’s go ahead and create the CallbackServlet.java in the Maven oauth2 directory src/main/java/be/rubus/workshop/oauth2:
Explanation
Lines 1 and 2: We creates the
CallbackServlet.Lines 25–31: Using the
doGet()method, we check the CSRF token.Lines 33–46: We exchange the authorization code for an access token (using the
ScribeJavapackages for imports), store the token within the session, and redirect to the original user-requested page.
Create Bean to retrieve data
We create a CDI bean that can retrieve the Calendar events linked to the ...