anchor.diff:            iv_error_text = |Authentication failed: { lv_http_code_description }|.
       ENDIF.
   
  -    " Authentication worked, now the rest client can be used
  -    CREATE OBJECT li_rest_client TYPE cl_rest_http_client
  -      EXPORTING
  -        io_http_client = li_http_client.
  -
   
       " 2. Create an access token which can be used instead of a password
       " https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
   
  -    li_request_entity = li_rest_client->create_request_entity( ).
  -    set_access_token_request( ii_entity    = li_request_entity
  +    set_access_token_request( ii_request   = li_http_client->request
                                 iv_repo_name = parse_repo_from_url( iv_url ) ).
  -    li_rest_client->set_request_header( iv_name  = if_http_header_fields_sap=>request_uri
  -                                        iv_value = lc_restendpoint_authorizations ).
  -    li_rest_client->post( li_request_entity ).
  -
  -    lv_http_code = li_rest_client->get_status( ).
  +    li_http_client->request->set_header_field( name  = if_http_header_fields_sap=>request_uri
  +                                               value = lc_restendpoint_authorizations ).
  +    li_http_client->request->set_method( if_http_request=>co_request_method_post ).
  +
  +    li_http_client->send( EXCEPTIONS OTHERS = 1 ).
  +    IF sy-subrc <> 0.
  +      raise_internal_error_from_sy( ).
  +    ENDIF.
  +
  +    li_http_client->receive( EXCEPTIONS OTHERS = 1 ).
  +    IF sy-subrc <> 0.
  +      raise_internal_error_from_sy( ).
  +    ENDIF.
  +
  +    li_http_client->response->get_status(
  +      IMPORTING
  +        code   = lv_http_code
  +        reason = lv_http_code_description
  +    ).
       IF lv_http_code <> 201.
         RAISE EXCEPTION TYPE lcx_2fa_token_gen_failed
           EXPORTING
  -          iv_error_text = |Token generation failed: { lv_http_code }|.
  -    ENDIF.
  -
  -    rv_access_token = get_token_from_response( li_rest_client->get_response_entity( ) ).
  +          iv_error_text = |Token generation failed: { lv_http_code } { lv_http_code_description }|.
  +    ENDIF.
  +
  +    rv_access_token = get_token_from_response( li_http_client->response ).
       IF rv_access_token IS INITIAL.
         RAISE EXCEPTION TYPE lcx_2fa_token_gen_failed.
       ENDIF.
  
positive.code:       authenticate_internal REDEFINITION.
    PRIVATE SECTION.
      METHODS:
        set_access_token_request IMPORTING ii_entity    TYPE REF TO if_rest_entity
                                           iv_repo_name TYPE string,
        get_token_from_response IMPORTING ii_entity       TYPE REF TO if_rest_entity
                                RETURNING VALUE(rv_token) TYPE string,
        parse_repo_from_url IMPORTING iv_url              TYPE string
                            RETURNING VALUE(rv_repo_name) TYPE string.
  
negative.code:     ls_result_line-value = lr_data_ref.
      APPEND ls_result_line TO lt_result_parvalues.
  
      lv_binary_response = ii_response->get_data( ).
  
      CALL TRANSFORMATION id SOURCE XML lv_binary_response
                             RESULT (lt_result_parvalues).
    ENDMETHOD.
  