Issues with Wordpress to XF Cookies URL & SSO.

Discussion in '[bd] API' started by Hugh Edwards, Dec 4, 2015.

  1. Hugh Edwards

    Hugh Edwards New Member

    Hello XFrocks.

    I've had limited success with your API and plugin. Very much want to get it to work. Is it possible to speak to you via telephone? I'm happy to pay a support charge if you can help.

    In the meantime, here is my issue:

    I've set up the WP Plugin V1.3.0b and I've installed the XF API that came with that release. I've got it connected in Wordpress and I can see all the options that appeared after it managed to connect to the XF API. I have permissions in XF set to allow as discussed for all user groups.

    Issue1: Incorrect URL's.
    Firstly, I'm getting the following URL's 404. The first is when I try and connect the admin account:
    https://www.voiceover.courses/voice..._type=code&scope=read post conversate admincp

    And secondly when I try and sign a user out of Wordpress:
    https://www.voiceover.courses/voice...uri=https://www.voiceover.courses/my-account/

    ....the reason it's failing is that it's putting in an extra /voiceover.courses/ after the initial domain.com. If you take this out, e.g.:
    https://www.voiceover.courses/xenfo...uri=https://www.voiceover.courses/my-account/

    .....then it works fine - but I can't see how to have your code stop the extra unnecessary part? It's worth noting here that to associate the admin account in WP-XF I had to manually remove that portion from the URL, so it's highly possible that all the issues described here are caused by the same issue, i.e., the locations that your code is looking for are all wrong either in the address bar or internally.

    Issue2: SSO Not Working!
    I'm presuming that the correct use of this software is that I have a user login in Wordpress and then go to voiceover.courses/xenforo and the user is logged in there? If that's the case, it isn't working, it's in the login screen. I have checked and it is copying over the user into the xf_user table on login correctly. I wonder if this is the same reason as above, i.e., it can't find the cookie for SSO? Any thoughts?

    Issue3: Not All Forums are Displaying in Tag/Forum Mappings.
    I have 8 forums in that xenforo instance and only one is displaying. This was displaying the single node after I 'forced' the admin association manually as described above. At the time of doing the association, all the rest of the nodes were set to private, which may be why only the one showed up, and the above point in red may be why they are no longer updating? As a point of note I'd really like to be able to

    Point4: Feature Request:
    Notwithstanding the fact that i can't get it to work, I can see that we're not far off getting it to work, and working this is would be perfect for our needs bar one thing. We need to be able to assign XF Primary/Secondary groups to users based on tags in WP. The reason for this is that we can then assign forum membership levels up and down (which is controlled in other plugins) automatically based on purchases. I would be interested in paying for this development...Do get in touch via my email address! :)

    Lastly - how do you change the sync frequency?

    Thank you very much for your help! :)

    Hugh.
     
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Hi there,

    Issue 1 seems to happen because of wrong configuration. Please take a screenshot of the main plugin option page so I can verify it.

    Issue 2: depending on your configuration, the bridge will check XenForo cookie and let user logged into WordPress automatically. If enabled, it can also log user into XenForo after he/she logs into WordPress. However, with issue 1 happening, it's unlikely cookie sync will work. Please resolve issue 1 first.

    Issue 3: you can refresh the node list by clicking "reload api info" in the plugin option page.

    Currently the plugin will sync WordPress user roles with XenForo user groups. That's not enough for you?
     
  3. Hugh Edwards

    Hugh Edwards New Member

    Hello X-Frocks! Thanks for the reply.

    Screen Shot 2015-12-04 at 11.31.28.png

    ...I'm aware that our URL is https://www.voiceover.courses and that the URL for xenforo is /voiceover.courses/xenforo/api - (according to our re-write rules - this is a test site and this will all be sorted out so they are the same once it's live with our gravyforthebrain.com URL) - but surely that wouldn't be why it would add an additional /voiceover.courses into the URL? The other option is that I just put in the API Root field "/xenforo/api". I did try this and unfortunately it doesn't work, probably because the URL's are different as described. If you think this will work, then I will just have to wait until go-live to try and get this working....we can't change all our re-write rules for various tech reasons until we move the production URL over to the dev environment. Do you think that would work?

    Yep agreed.

    Yes, that wasn't working for us. Then when I tried changing the URL it lost the API info when it failed, and then when I put it back again as it was before so it could see the API, it refreshed everything properly.

    Again, that complete set of fields wasn't showing so I wasn't aware of it - when I refreshed the API connection as above, they all appeared for me and yes....that's definitely enough for me! :) In that case though, what is the function of the Tag/Forum mappings?

    Thanks for all your help so far! :)
     
  4. xfrocks

    xfrocks XenForo rocks!
    Staff Member

  5. Hugh Edwards

    Hugh Edwards New Member

    Hi. It didn't actually work for SSO, but it did fix the signout issue - I am just going to have to wait until we put it onto our live site to test that with a working URL and SSL I think.

    However you could help me a little further. One of the limitations at the moment is that a user registers, and then has to log out of wordpress and back into it to have their account created on XF (which then does work with the same password successfully) - this is a bit of a messy user-journey. I'd like to be able to program this into our site on successful registration so that the XF account is created then. Could you please tell me the right hooks that we will need to use to do this?

    Thank you!
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @Hugh Edwards This is the designed behavior. Regarding what you asked for: at the time of WordPress registration, the user password is not accessible (it has been hashed) making it impossible to create the XenForo account correctly. I can create the XenForo account upon WordPress registration but user won't be able to log into that account directly (via XenForo form) until a successful WordPress login is made. Not sure if that works for you?
       
  6. Hugh Edwards

    Hugh Edwards New Member

    Hmmm. Are you taking the password from the login form? If so, can you not take that from the Registration form? It's the same principle surely? Can you not create the account and the SSO cookie at the Registration point? What is different about the login where the password is not hashed?
     
  7. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Hi there,

    The password is submitted via POST but fetching the password that way is not secure and may cause conflict if something happen between user submitting the form and the plugin actually running. WordPress provides support for custom authentication so it supplies a fully prepared password upon login, making it possible to sync the password correctly to XenForo.
     
  8. Hugh Edwards

    Hugh Edwards New Member

    Hello.

    Ok so I've just moved from the development server (above) to our new production server and again I can't get the connection between wordpress and xenforo/api.

    Our WP install is a multisite one and I have it activated just on the root site (I've also tried network activating it but that doesn't work either. Here are my settings:
    siteurl: https://www.gravyforthebrain.com and the xenforo install is at /xenforo. The API v 1.4.4 is installed correctly. Wordpress plugin is: Version 1.3.0b

    Welcome to Gravy for the Brain Voiceover Training

    Become a better Voiceover Artist with the complete Voiceover Career Training Platform.
    gravyforthebrain.com


    Here are the settings:

    Screen Shot 2016-01-07 at 14.01.56.png

    I'd really appreciate some help if possible. I'm happy to pay for support.
     
  9. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    I have checked your api endpoint (https://www.gravyforthebrain.com/xenforo/api/) and it appears to be correct. The issue may be with the api key/secret pair. Please start a conversation with me with your production server info if possible. I will come and check it personally.
     
Loading...