Support » Plugin: Theme My Login » TML and WP REST API and oAuth1 Not working

  • Hi

    I have WP 4.6.1 installled.
    Also WP REST API and WP REST API – OAuth 1.0a Server
    and ACF to REST API

    The problem is that when attempting to authenticate,
    the request works and the token_request is generated but when I go to the authorize end point with the parameters collected from the request end point, I get a 500 error.
    The reason is that the authorize URL with parementes redirects to /login?action=oauth1_authorize&…
    and that throws a 500 error.

    I flush the permalinks and remove all plugins until by removing TML got it working.
    In the settings I hide wp-admin and I guess that is why it is not working.

    Are you working in something to fix this bug?
    Thanks
    Dante

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    This is my first time hearing of the bug. Please report to Github.

    The problem is very simple, in the unit oauth1-authorize.php you have the tag
    <button type=”submit” name=”wp-submit” value=”authorize” class=”button button-primary button-large”/><?php _e(‘Authorize’); ?></button>
    <button type=”submit” name=”wp-submit” value=”cancel” class=”button button-large”><?php _e(‘Cancel’); ?></button>

    This First Submit button send a value equal “Authorize” and no “authorize”, the same for the Second Button, it send “Cancel” and no “cancel”, this very important for the unit class-wp-rest-oauth1-ui.php where receive the value in switch

    switch ( $_POST[‘wp-submit’] ) {
    case ‘authorize’: …
    case ‘cancel’: ….
    default: ….
    }

    You need change in this unit the cases for :

    switch ( $_POST[‘wp-submit’] ) {
    case ‘Authorize’: …
    case ‘Cancel’: ….
    default: ….
    }

    Or change the tag the unit oauth1-authorize.php for <input value=…./>

    I test this, it is OK, it Work!!!

    The are a Second problem with this plugin is it have a problen when you have a URL with ‘ ‘(space) o ‘~’. The problem is the function static urlencode_rfc3986 in class WP_REST_OAuth1 in unit class-wp-rest-oauth1.php, the definition is

    protected static function urlencode_rfc3986( $value ) {
    return str_replace( array( ‘+’, ‘%7E’ ), array( ‘ ‘, ‘~’ ), rawurlencode( $value));
    }

    But really no make this function, because the str_replace need change the array, the new definition work:

    protected static function urlencode_rfc3986( $value ) {
    return str_replace( array( ‘ ‘, ‘~’ ), array( ‘+’, ‘%7E’ ), rawurlencode( $value ) );
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘TML and WP REST API and oAuth1 Not working’ is closed to new replies.