How do I actually setup SSO with Vanilla jsconnect? - php

I have a site with a basic members auth system built into it, I wanted to allow the logins for this site to also work on a vanilla forum using the jsconnect plugin. The forum is built within a folder of the site.
I've been through the documentation for the jsconnect plugin for vanilla forum.
However I can't quite grasp the process of actually setting it up, This is where I'm at right now;
I've downloaded and installed the jsconnect plugin within vanilla forum, I can access it within settings. However when i try to add a connection, once I hit submit I get a blank error screen:
Something has gone wrong.
We've run into a problem and are unable to handle this request right now.
Please check back in a little while.
I'm assuming this has something to do with me needing to have set up an Authenticate Url that goes somewhere, however what is it supposed to point to?
I read that I need to have a jsonp file however when i look at the jsconnect repo https://github.com/vanilla/jsConnectPHP Theres an index.php file that seems to handle the authentication, is that right?
Essentially I'm looking for some guidence on how I should proceed,
Any help would be sure appreciated!

you need to download the index.php file, then change the path for functions.jsconnect.php to /plugins/jsconnect/functions.jsconnect.php.
then add a connection and test url.

Related

New to Wordpress and my new web host has it by default so I am stuck

I recently obtained a domain and website through bluehost. They have Wordpress installed and I am unable to figure out how to bypass it so I can code old school. I would really rather learn Wordpress but don't know where to start.
So two questions:
1.
what wordpress files are blocking me from the site recognizing the usual Default page's code? (I create test html in Default which is bypassed somehow and will only show Wordpress default page in progress; my code is not overwritten; just ignored?)
2.
I'd be happy to learn myself, but don't know a good resource. Went to Wordpress site and they have free webpage I can play with. Should I just get the free one in order to learn whats what...or is that going to be dumbed down and different than having it installed in webhost site?
I am a fairly advanced programmer and feel that I should be able to pick this up rather quickly if I can only get past this first hurdle.
Thank you for any information or suggestions.
What loads by default at a domain (ex: www.yoursite.com) is controlled by the web server which uses a configurable list of filenames like index.html, index.php, Default.aspx etc. You can learn more about how that works here.
Normally, your web host will allow you to have some control over that list, and the precedence one file takes over another when the web server refers to the list. Perhaps you have an administrative interface or dashboard control which allows you to configure this for your site. If not, you'll have to contact support at your web host to have changes made to that list.
1) Nothing is blocking you from seeing a page on your web server at a specific address, only from allowing one page or another to be what loads by default at the root web address, as explained above. If you have FTP access to your website directory, and can upload a file there, you can still browse directly to it, even though the WordPress installation's default page is showing up at your root web address. Just enter the specific file name in your browser, and you will browse to that page, ex: www.mysite.com/somepageicreated.html
2) Learning is always good either way, but you either want to learn to make WordPress sites or you want to learn to make your own websites. I'll assume WordPress for now, since you mentioned a preference for that platform. Just remember though: working with WordPress sites is not making your own website, it is changing a WordPress template to be as close as possible to what you want your website to be. This may or may not suit your requirements.
Playing with a free example from WordPress can be very useful for picking up the basics. Once you've played there for awhile and feel a bit more aware of how things work, take what you've learned and apply it to shaping your own site into what you'd like. Just remember to always create a backup of anything you mess with, so you can always return to an earlier state if you really mess things up good :)
Good luck!

Drupal 7: Localhost/user link defaults to website/user

I am really new to Drupal and playing around with this existing Drupal site.
I did a FTP transfer of all the files to my local computer directory. I currently got it on a Vagrant box and I can access the site via http://192.168.56.101/html.
I can do http://192.168.56.101/html/anything-but-user and it brings me to the proper area on the site. However I can't do localhost/html/user, because it redirects me to the website URL rather than the local URL.
I tried clearing the cache (with Drush). I scanned all files in the system and changed the web url to the local URL [not sure if I need to do any other command], and I can't seem to find anything in the .htaccess files that would lead me to this.
The href="/user I would greatly appreciate any advice or help in figuring out this solution.
--UPDATED
There was a module called "Secure Pages" that was causing the user and registration links to be locked and static to prevent redirects to phishing sites. I had to disable this module using "drush pm-disable securepages" in the terminal.
Some typical items you may want to check:
Check if you get the same problem using another browser. If with another browser it works, then it is pretty sure a cookie problem. To solve that, delete the cookie in the browser where you have the problem.
Make sure "clean urls" is enabled. Refer to "https://drupal.stackexchange.com/questions/165029/clean-url-leads-to-duplicate-url-after-migration-to-another-hosting/165044?s=1%7C3.9647#165044" for more details on that.
Make sure the value of "base_url" is set correctly (in your settings.php).
If module Secure Pages is enabled, then try to (at least temporary) disable that moduel to see if it helps.
Apparently, there was a mod called "SecurePages" that was causing the URLs to be static to prevent someone from changing them and redirecting users to a phishing site.

Redirecting *.appspot.com to custom domain for WordPress on Google App Engine using PHP

I have WordPress installed and running on GAE and have added my own custom domain via Google Apps. This is great but my appspot.com url is still publicly accessible and searchable.
How would I go about blocking this and redirecting to my custom domain?
I imagine it involves adding a url handler in the app.yaml file that points to a php file. I have no idea what would go inside though.
Also, how would I then go about setting up a 301 redirect for website canonisation and SEO that accounts for SSL and cron entries?
Any help is appreciated, thanks!
The appspot.com URL is always accessible and there is no way to turn it off. You can't do much in the app.yaml since it's not aware of the custom domain. I'm not really a PHP guy but you should do is to write manually the redirect based on the host URL if you really want to do that. Since you're using WordPress you might need to do quite some work if you don't want to redirect only from the root, but from any page.
Personally I think you should just leave it there and do nothing, even Khan Academy is not redirecting (http://khan-academy.appspot.com) and I'm pretty sure that very few are actually doing that.

OAuth 2.0 and Amazon Beanstalk

I'm relatively new to programming and am having trouble with using OAuth with my app hosted on Amazon Beanstalk.
What I wish my app to do is to connect to the Constant Contact API, using the base code shown here
https://github.com/shannon7wallace/OAuth-2-PHP-Example
If I execute this code locally, everything works fine. I am able to login with my constant contact credentials and pull data. I was sure to setup my redirect uri in my constant contact developer key correctly, and everything works perfectly locally.
When I deployed it to AWS however, I would get a blank page when trying to navigate to index.php. I double checked my container settings and the zip package I uploaded to ensure I was pointing to the correct directories, and made sure my AWS healthcheck pointed to a publicly accessible URL (AWS shows app as being healthy), but the page is blank.
If I replace my index.php with simply HTML or even phpinfo(), it works. I suspect it gets hung up at the authentication check but even if I hard code my account credentials in and remove the login logic, I still get a blank page. Even the html outside my php script tags does not display, regardless if I include things like or other head tags.
Googling for OAuth + Beanstalk produces very little, and the constantcontact API documentation, at least to my inexperienced eyes, is pretty sparse, but the closest thing I could find addressing my problem is this
https://forums.aws.amazon.com/thread.jspa?messageID=277339&#277339
The scenario in the above thread seems to address a problem much more specific than mine, and I am unsure on how to apply the solution to my particular case.
Is there something obvious I am missing? I can't believe AWS would be unsuited for apps using OAuth considering the vast array of projects that are hosted on it.
I appreciate any help anyone can offer.
The Beanstalk container options for PHP have an option to control whether errors should be displayed; switching it to "On" should write a fatal error on your page.
As it turns out, even after changing the setting, the pages would still be blank. I'm not sure if the feature is broken, but it definitely guards you from accidentally leaving it on :)
You'd have to log into your instance (assuming your site isn't loaded yet and it's really just one) and edit your code to insert the customary debug statements as high up as possible:
error_reporting(-1);
ini_set('display_errors', 'On');
Barring any parse errors in your page, it will show the offending error.

Why does the Facebook backend return 0 as the user id when authenticating from within a WordPress plugin?

thanks for reading! Here's what I'm up to.
I'm writing a WordPress plugin that makes use of the PHP SDK (latest version 3.1.1) that Facebook provides. My application is registered with Facebook as a website because it infact acts like a website, even though it's embedded in WordPress.
This SDK comes with an example.php that is very straightforward and easy to understand. If I put this file on my server, it just works. I made sure that the certificate file and the SDK files are in the right place and accessible by the script.
However, if I do the exact same thing from within a WordPress plugin (from the admin page of the plugin), the Facebook backend won't return the user id but will always return 0 instead. The problem with FB returning 0 is pretty common, but the reasons for it seem to vary a lot.
I have to mention that this behavior wasn't always like this. It began just a few weeks ago. I'm suspecting that the FB backend somehow checks for indirect API calls and that calling it from within a WordPress plugin seems to violate FBs auth rules in some way (CSRF issue?). But I'm not sure.
Has anybody got a clue what's going on here?
Here's my guess:
Facebook will not be able to access the backend of your WordPress blog since it requires authentication. So the example.php code will not be visible to it from a WordPress admin panel.
When served raw on your server, there are no such access controls and Facebook is able to reach the page.
If this is the case, my suggestion would be to turn this into a non-admin plugin, perhaps by adding a rewrite rule using the WP_Rewrite class.

Categories