public void doFinish ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { if ( ! common . checkGet ( request , response ) ) return ; User user = common . requireLoggedInUser ( request , response ) ; if ( user == null ) { common . pageSoftError ( response , "Can't do /dropbox-auth-finish. Nobody is logged in." ) ; return ; } DbxAuthFinish authFinish ; try { authFinish = getWebAuth ( request ) . finishFromRedirect ( getRedirectUri ( request ) , getSessionStore ( request ) , request . getParameterMap ( ) ) ; } catch ( DbxWebAuth . BadRequestException e ) { common . log . println ( "On /dropbox-auth-finish: Bad request: " + e . getMessage ( ) ) ; response . sendError ( 400 ) ; return ; } catch ( DbxWebAuth . BadStateException e ) { // Send them back to the start of the auth flow. response . sendRedirect ( common . getUrl ( request , "/dropbox-auth-start" ) ) ; return ; } catch ( DbxWebAuth . CsrfException e ) { common . log . println ( "On /dropbox-auth-finish: CSRF mismatch: " + e . getMessage ( ) ) ; response . sendError ( 403 ) ; return ; } catch ( DbxWebAuth . NotApprovedException e ) { common . page ( response , 200 , "Not approved?" , "Why not, bro?" ) ; return ; } catch ( DbxWebAuth . ProviderException e ) { common . log . println ( "On /dropbox-auth-finish: Auth failed: " + e . getMessage ( ) ) ; response . sendError ( 503 , "Error communicating with Dropbox." ) ; return ; } catch ( DbxException e ) { common . log . println ( "On /dropbox-auth-finish: Error getting token: " + e ) ; response . sendError ( 503 , "Error communicating with Dropbox." ) ; return ; } // We have an Dropbox API access token now. This is what will let us make Dropbox API // calls. Save it in the database entry for the current user. user . dropboxAccessToken = authFinish . getAccessToken ( ) ; common . saveUserDb ( ) ; response . sendRedirect ( "/" ) ; }
an HTTP POST .