Use Java to get email from the Callback

I have the following code to create my Auth0 Request…

public String getAuthUrl(HttpServletRequest req){
    return this.controller.buildAuthorizeUrl(
            req, getRedirectUrl(req)
    ).withAudience(
            String.format(
                    "https://%s/userinfo",
                    appConfig.getDomain()
            )
    ).withScope("openid email profile").build();
}

But I cannot figure out how to get the email out of the session in

public void handleCallback(HttpServletRequest req, HttpServletResponse res)

How do I extract out the email without calling back to auth0?

Seems like I can get it like

 ((PayloadImpl)((JWTDecoder)tokenAuth.jwt).payload).tree.get("email")

But that seems really hacky.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.