@@ -38,6 +38,7 @@ public class FrontendController {
3838  public  FrontendController (
3939      @ Value ("${projectID}" ) final  String  projectID , @ Value ("${apiSecret}" ) final  String  apiSecret )
4040      throws  StandardException  {
41+ 	// Or use Config builder 
4142    final  Config  config  = new  Config (projectID , apiSecret );
4243    this .sdk  = new  CorbadoSdk (config );
4344  }
@@ -66,29 +67,20 @@ public String profile(
6667      final  Model  model , @ CookieValue ("cbo_short_session" ) final  String  cboShortSession ) {
6768    try  {
6869      // Validate user from token 
69- 
7070      final  SessionValidationResult  validationResp  =
7171          sdk .getSessions ().getAndValidateCurrentUser (cboShortSession );
7272
73-       if  (validationResp .getError () != null ) {
74-         // Handle invalid token. In this case we will forward the error message to the page. 
75-         throw  validationResp .getError ();
76-       }
77- 
7873      // get list of emails from identifier service 
7974      List <Identifier > emails ;
80- 
8175      emails  = sdk .getIdentifiers ().listAllEmailsByUserId (validationResp .getUserID ());
82- 
83-       // 
8476      model .addAttribute ("PROJECT_ID" , projectID );
8577      model .addAttribute ("USER_ID" , validationResp .getUserID ());
8678      model .addAttribute ("USER_NAME" , validationResp .getFullName ());
8779      // select email of your liking or list all emails 
8880      model .addAttribute ("USER_EMAIL" , emails .get (0 ).getValue ());
8981
9082    } catch  (final  Exception  e ) {
91-        System . out . println ( e . getMessage ()); 
83+ 	   //Handle verification errors here 
9284      model .addAttribute ("ERROR" , e .getMessage ());
9385      return  "error" ;
9486    }
0 commit comments