Forum Replies Created

Viewing 10 replies - 16 through 25 (of 25 total)
  • Thread Starter brianlmerritt

    (@brianlmerritt)

    So at least you know what the problem is – you need to use wp cli to get the key and just need to fix that.

    Thread Starter brianlmerritt

    (@brianlmerritt)

    ps – if the above instructions do work and you then get OAuth signature does not match on your own code then the problem is probably with the HMAC-SHA1. However, OAuth explorer should work once you have the right key and secret via WP CLI.

    I hope they come up with something better before release into 4.1. It is probably too much to hope that a better OAuth mechanism for mobiles is in place (or better documentation so I know what I am doing) ?

    Thread Starter brianlmerritt

    (@brianlmerritt)

    Looks like the key/secret may not be set up correctly.

    Below shows you how to set up the keys via client-cli

    https://github.com/WP-API/client-cli

    The developers are fulling committed to 4.1 launch, so I don’t see us mortals getting support this side of Christmas ??

    Thread Starter brianlmerritt

    (@brianlmerritt)

    Have you tried OAuth Explorer

    https://sevengoslings.net/~fangel/oauth-explorer/

    It has a few weird quirks with JSON REST API, but works OK in stages:

    1. Enter base url (http(s)://your.domain.com/oauth1
    2. Access token = request
    3. Authorize = authorize
    4. Access_Token = access
    5. Enter your consumer key and secret (leave method as HMAC-SHA1)

    Now the fun begins!

    Click Get Request Token and you get Call content = “No Oauth parameters supplied” – no idea why, but…

    Copy the contents of “combined call (as GET)” into “CUSTOM API CALL” (delete any existing content) and press the “Call” button

    Call content now = oauth_token=xxxxxxxxxxxxxxx&oauth_token_secret=xxxxxxxxxxxxxxxxxxxxx&oauth_call_back_confirmed=true

    So – paste those manually into Request Token (oauth_token value goes into Request Key and oauth_token_secret value goes into Request Secret)

    Now click authorize

    Your browser gets redirected to the website “wp-login.php?action=…”

    You then have to authorize the token manually, and you get your verification token

    Go back to OAuth Explorer and click “Get Access Token” and enter the verifier code and click get access token.

    Of course that produces another “No Oauth parameters supplied, so you then paste Combined call as get back into custom api call.

    You then get your oauth_token and oauth_token_secret back.

    The OAuth doesn’t “appear” to be set up for mobile users, but there are other authentication methods:

    Cookie (but we can’t use as we are not in the domain, as far as I know)

    Basic Auth (keep sending the username and password with the request)

    Token (send the token – have not yet explored this in detail)

    Basic Auth and Token and OAuth all require plugins – have a look at them and you might find enough code to create your own plugin with a more sensible authorisation method.

    If your mobile app allows the user to create a new user ID then you need some way to give the app the ability to create the user via the API (or send the user to the website and tell them just create their own ID there)

    If the above helps at all great – at least you can test out your install.

    I am going to work on an auth plugin that requires basic auth the first time, and then passes a token which the token auth can use to identify the user (hopefully!!!)

    Thread Starter brianlmerritt

    (@brianlmerritt)

    Hmmm – or should I just be using cookie authentication for the mobile app? ??

    Thread Starter brianlmerritt

    (@brianlmerritt)

    Thanks David for your fast reply!

    I had a look at AppointmentsPlus in more detail.

    One more quick question – can I allow service providers to set their own working hours and settings without giving them access to the full backend control panel or other service providers information or bookings?

    Ignore the <h3> bit ??

    I have tested this in The Bootstrap theme and by adding the above CSS to style.min and changing the php of “inc/nav-menu-walker” line 47 (make sure your line matches the one below before modifying) from:

    $attributes .= $args->has_children ? ' class="dropdown-toggle" data-toggle="dropdown"' : '';

    to

    $attributes .= $args->has_children ? '' : '';

    <h3>congratulations – you now have a fully working Menu system in WordPress AND an awesome theme</h3/

    Ps – I seem to have messed up the link to the stackoverflow site, but if you click on any of the blue text, it will take you to the discussion.

    There is an interesting discussion on stackoverflow which describes how to change the default behaviour of the bootstrap navbar so that you can get dropdown on hover, rather than having to click.

    https://stackoverflow.com/questions/8878033/how-to-make-twitter-bootstrap-menu-dropdown-on-hover-rather-than-click

    CSS to change the menu to drop on hover, rather than just on click is:

    .sidebar-nav {
        padding: 9px 0;
    }
    
    .dropdown-menu .sub-menu {
        left: 100%;
        position: absolute;
        top: 0;
        visibility: hidden;
        margin-top: -1px;
    }
    
    .dropdown-menu li:hover .sub-menu {
        visibility: visible;
    }
    
    .dropdown:hover .dropdown-menu {
        display: block;
    }
    
    .nav-tabs .dropdown-menu, .nav-pills .dropdown-menu, .navbar .dropdown-menu {
        margin-top: 0;
    }
    
    .navbar .sub-menu:before {
        border-bottom: 7px solid transparent;
        border-left: none;
        border-right: 7px solid rgba(0, 0, 0, 0.2);
        border-top: 7px solid transparent;
        left: -7px;
        top: 10px;
    }
    .navbar .sub-menu:after {
        border-top: 6px solid transparent;
        border-left: none;
        border-right: 6px solid #fff;
        border-bottom: 6px solid transparent;
        left: 10px;
        top: 11px;
        left: -6px;
    }

    And to be able to click on the Parent (dropdown) menu link, you need to remove the

    class=”dropdown-toggle” data-toggle=”dropdown”

    From each parent LI

    In other words:

    <a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown2 <b class="caret"></b></a>

    becomes

    <a href="#">Dropdown2 <b class="caret"></b></a>

    The bootstrap default is not to do this, but this makes no sense in a WordPress environment Konstantin. Do you fancy an extra config setting for the menus ??

Viewing 10 replies - 16 through 25 (of 25 total)