public TokenSession getSessionToken ( TokenAuthorisation token ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; if ( ! token . getSuccess ( ) ) { throw new MovieDbException ( ApiExceptionType . AUTH_FAILURE , "Authorisation token was not successful!" ) ; } parameters . add ( Param . TOKEN , token . getRequestToken ( ) ) ; URL url = new ApiUrl ( apiKey , MethodBase . AUTH ) . subMethod ( MethodSub . SESSION_NEW ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { return MAPPER . readValue ( webpage , TokenSession . class ) ; } catch ( IOException ex ) { throw new MovieDbException ( ApiExceptionType . MAPPING_FAILED , "Failed to get Session Token" , url , ex ) ; } }
This method is used to generate a session id for user based authentication .