Sharing session data between rails and wordpress - php

I have two web apps running. One is a rails app which is the beef of the application, and the other is a wordpress app(for an online store).
My challenge is sharing login data/session data between the two apps. So If I log into the rails app, and then click the shopping tab, how do I transfer the user session over to the wordpress site?
Also Vice versa. If I am shopping on the wordpress site, and want to login to purchase items, how can I login via the rails app?
I believe there are single sign on plugins that can achieve this, but I have not found anything that is to specific on how to achieve this. For some reason wordpress is awfully terrible to develop around :(.

Are the 2 applications running on the same host? Same domain? Sharing database?
Sounds like your best option is some sort of authentication service, like one of the many OAuth authenticator services (Facebook, Twitter, etc.), or writing your own OAuth service.
Alternatively, if the 2 applications are small-scale and running on the same machine, it might be possible to modify the session handler for either the rails app or WordPress to use the other's session data. I suspect WordPress would be the easier of the two to modify, but I have bias toward PHP
Did a quick search and found this article about modifying Rails cookie sessions to use with PHP.
https://www.coffeepowered.net/2011/08/24/rails-cookie-sessions-and-php/
I also found this article which might be exactly what you're looking for?
http://code.tutsplus.com/tutorials/build-a-custom-api-to-connect-wordpress-with-ruby-on-rails--cms-21189
Unfortunately, I have never attempted this from either direction. But I am very familiar with WordPress, and believe it could be made to corporate with Rails sessions, given enough blood, sweat and tears.

Related

iOS app tweaked for server connection

I'm currently developing an iOS app and have reached the point where I need to implement a server back-end in order to support the core functionality.The app is built in a way to store certain questions locally (Within the app) and pose the questions to the app user. I need to tweak it such that it retrieves the question from a remote server. Furthermore, the question will reside in a specific folder within the remote DB. So the app will have to fetch the questions from the appropriate folder based on user login.
I have zero server experience and am need of some advise as to where I should begin with this. I would like to know if there is a template spec for this kind of task. With a template spec, I can hire a programmer and talk intelligently. Please help!
Here is a number of solutions:
1) You can use other services that provide backend functionality with REST API (as #Niklas Hein mentioned), it calls BAAS - backend as a service, such as Parse (but Parse is closing his service in one year), BaasBox, etc.
2) You can use CloudKit. This is service created by Apple, where you can store app data in the cloud, with authorization, requests, admin panel, etc.
3) Create you own back end. Here is a large number of languages and web frameworks, so php is not the only one solution. Ruby on Rails, Python Django, NodeJS, and many others on your choice.
There are plenty of BAAS (Backend as a service) provider, like Parse or Firebase. You might want to have a look into them. (Although Parse is going to shut down.)
Another simple way is to look into PHP Laravel.
Laravel is a great Framework which makes it really easy to set up a backend.
Have a look at Laracast

How to access existing APIs using Slim Framework from a PHPFox website on mobile app (iPhone and Android)?

I've one website built in PHPFox. The website is functioning properly. Now the mobile apps for iPhone and Android smartphone are under development which will use the same database that PHPFox website is using.
So, I want to make the existing APIs that are used for a PHPFox website available to the mobile apps (both iPhone and Android) as well. I don't want to reinvent the wheel again and want to re-use the same existing code for mobile apps.
I did a lot of research about this. I've spent almost four days on the research. I didn't get a single link which will explain me how to access the existing APIs from a PHPFox website for mobile apps (iPhone and Android).
One option I found from my research is creating new RESTful webservices using PHP or implement any such framework like Slim, apigility, etc.
But I think following any of the above two approaches will be a overhead and re-usability of code will also not be achieved. If the code which is working fine for website should also be used used on mobile apps. There should be no need to write the same code again. That's what I think.
So using the existing APIs from PHPFox website is the best solution that I think, might be I'm wrong. If you think I'm wrong please correct my approach.
If you could explain with some useful example it would be really great.
I've gone through PHPFox docs as well but couldn't get anything useful which could help me in the issue I'm facing. If you are also interested in documentation of PHPFox please go to below links:
http://unity.moxi9.com/docs
http://unity.moxi9.com/kb
If you could find anything useful related to the issue I'm facing please do let me know.
Well everything you are looking for is already there in the docs. Your mobile app would be registered as an app with PHPFox. You can then use their API. The remaining question is, if the end users need to authorize your mobile app from their "normal" web browser or if this authorization can be performed from the mobile app as well. At least that's what I read from the docs. Since you have an up and running installation at your hand: Just try it! Register an app and perform some requests to their API.

Accessing Wordpress remotely

I was in the process of developing an app in Titanium Mobile. (It's a great way to develop apps btw if you're a web dev).
This app communicates and gets data from a Wordpress server.
(In case you're not familiar with Titanium Mobile, I request you to keep reading the question. Knowledge of that platform is not necessarily important in this case. Thanks)
After a lot of research I finalized on the Wordpress JSON API as a method of communication between the app and the server.
I've got it all up and running successfully and it's great. So far so good.
Now the problem is that my app requirements exceed the functionality provided by the JSON API.
For example, I would like a user to "log in" and maintain a session while using the app. He should be able to edit his Wordpress profile info, etc.
I just want to have an idea how I would be able to best implement this.
One way could be to have a php script running on the server which handles each and every function. Another could be to manually edit the JSON API to add more functionality to it. But that'll take time and I haven't developed a Wordpress plugin before.
Can anyone suggest me a better or easier way of doing the above? I hope I've described what I'm looking for. Apologies if it's too long. I wanted to best explain it.
Thanks for the help in advance!
Wordpress has a XML-RPC interface already, no need to re-invent the wheel.
Wordpress XML-RPC SupportCodex
Wordpress XML-RPC APICodex

Ruby SSO, CAS, oauth, userstore. What options do I have?

Q: How would you create a SSO? What would you do about authentication (separate app or same as sso) and user store?
Background info:
We have 40+ php apps, java apps and
Ruby apps.
Currently, we have a custom
SSO+authentication solution. It's an
app written in php that is now used as
SSO, while supporting
email/username/phone-number + password
as authentication. It works, but was
built for a few apps only, not
originally meant to be the SSO -
solution. It doesn't have a usable view, every app create their own login/register forms and use the API. They share context and we'd like a more universal design.
Now we know want to support Oauth and
openid solutions, as facebook connect,
google and more, (or do we really?), in addition to
existing authentications. We can
expand existing php-solution, but we
are considering alternatives.
If you were to do all this in Ruby, what would you do?
Some additional info:
All users exist in SSO, today.
The company does aquire other companies/systems at times, having their own users. Would you migrate or create some kind of mapper?
Customers in a Microsoft CRM, but I consider this unrelated. Or do I?
I've shallowly looked at RubyCAS and ClassyCAS, and don't know if they are suitable. Is CAS the way to go?
Would you keep going with php? What would you use?
As you see, I have a lot of questions. What would you suggest?
I a previous job we used Jasig CAS for SSO (several apps in Java and Python). After getting over some quirks in the configuration and my dislike of all things Java, it actually worked pretty well. At the time I found the wiki to be a valuable resource, but things might have changed in the last year.
Authentication was handled via a separate app (custom) using an OpenLDAP directory that was preinitialized with a script that got user info out of an AD server.
Regarding the actual server you might actually want to use the Jasig one, IIRC it's the reference implementation and is easy to customize via a Maven overlay.
Ruby-cas FTW.

Developing Mobile App (Iphone,Blackberry,Android) for an existing website

I have a website and am planning to develop a mobile version of it for the iphone, blackberry and android.
My website is a social network built on PHP Zend framework. Now all these mobile apps are going to be having the same functionality like the website.
I am little ignorant about this - but from a high level I understand that all these mobile apps should not have to write any backend logic. For every functionality - they will simply make a web service API call to interact with the backend.
So does that mean, for every functionality I need to create a web service method. Can the existing code be re used - I'm a little lost -
Can someone shed some light on this matter or point me in the right direction (like some articles)
Thanks
I think the best thing for this kind of application would be write a mobile website. This should not include more than some new views in your Zend framework application.
There are some tutorials out there how to start. Just use your favorite search engine.
Apple and Android have browsers which are very advanced. They actually show the site in total. The point is would your website look better in that interface? ( I bet it would be cumbersome). You would have to make a mobile site (as suggested by #Felix) and implement the required features in a simple interface.
If you want an installable application then you are looking at three applications(one for each platform). My suggestion would be to make the mobile site and look for an app maker kind of product which would install your regular mobile site as an application on these platforms.
HTH
This is a very open subject that's obviously going to divide opinion (as already demonstrated it seems! :))
My personal view on it it this, using Safari on my iPhone is a terrible clunky cumbersome experience and "mobile optimised" websites are not ideal and don't really take advantage of the features of the device you are developing for (i.e. multi-touch etc)
This is why I think mobile applications are more appropriate ways of encapsulating the content of the web and delivering in a format suitable for its platform. Take for example, the Facebook application for iPhone and Android. That's a perfect example of taking the core features of the website and contextualising it in a manner that's easy to use and designed from the ground up for the device it's made for.
In answer to your question then yes, I would approach the development with web services in mind and use these to feedback the relevant data you need to interface with your site
While I agree with djhworld that the native mobile applications are sometimes easier to use than mobile-optimized web apps, there is a pretty big gulf in implementation time and user base fragmentation. I think the best first step is to develop a mobile web application, and if you are getting use there, consider developing native apps using web services. You may also want to look at PhoneGap as a way to cross-compile a single mobile app:
http://phonegap.com/
Also, see my other post about mobile web application development.
If you want to maximize your investment in your mobile site, I would develop it in HTML5. Currently, only WebKit browsers support it (iPhone/iPod/iPad/Android/Blackberry[soon]), but within a year most devices in developed countries will support it.
If you need to detect mobile devices on the server side, I would recommend Tera-WURFL. It is a high-speed PHP & MySQL mobile device detection software package that is free and open source.

Categories