The first major part of the app is to aggregate results from both Uber and Lyft to let someone get a ride from point “A” to point “B”. Yeah, I realize there might be plenty of mobile apps out there that can already do this, including the official Uber and Lyft app, but this is for fun and experimenting with Vue and Ionic 4. There was some complications when developing this view component with the app, but most of those were solved with in a couple of days like figuring out how to use Ionic more complex components like the ModalController
:
this.$ionic.someController
While some were solvable, but there are two that I am still having issues.
The first major problem is more of a security and best practices case is storing the REST API keys for both Uber and Lyft. Both of their services uses a public and private key; like most REST API services out there. Problem is that most of my code is client-side with just using JavaScript. Anyone that knows a little bit about web development or design can just look at the source code from either the page source or the inspection menu from their web browser of choice.
I looked around for solutions; some suggested JWT which I had used in the past, but I wonder how that would work with third party API keys. There was suggestions for Oauth, again, how to handle that with third party servers? I was kind of tempted to make an .env file to store the keys in a file, but someone can just rummage through the mobile install file (like an .apk) and just find those keys like finding your private post key for your cryptocurrency.
I’ll explain my possible scenario later as it comes hand-to-hand with the second major problem.
That second major problem is CORS:
CORS, my nemesis of REST API returns, but this is going to be tricky when I am dealing with CORS against a third party server which I have no direct way of accessing unless I am a developer for both Uber and Lyft. The stupid thing is that I am doing things the correct way with both of the REST APIs, but they refuse to cooperate.
First major issue was trying to retrieve the Uber authorization token after a user successfully logs with Uber with a proper redirect. Funny though, I am able to retrieve products from the Uber even when using an access token; all thanks to the Postman application.
Second major issue was trying to get data from Lyft, yet I am able to successfully fulfill their three-leg process with getting an access token. Funny how things not work. Yet, I am still able to retrieve the driver types via Postman. Sigh…
Regardless, I have the Vue application set up to translate both data so that both results can be mixed together and will eventually sort them based on prices. I may add more sorting options later on, but I’ll be happy if I get either to freaking cooperate.
And here comes my possible solution for both of the issues: Node. I’ll be honest I am personally excited to finally get to use Node.js since I have no experience using it besides calling NPM calls from the command line to get libraries and other goodies. I’ll be using custom REST API from Express to get all of the REST API keys that I need, and they may be stored in a database, like MongoDB (I guess this project might be MEAN stacked).
Now, for the stuff that does work. It took me a while to get the modal to work with the app which means I figured out how to get any of the other Ionic components to work. This modal will be used to display the detailed data of the driver type/product from either Uber or Lyft. The data, that is being sent as a property from one component to the modal is a uniform data to handle both Uber and Lyft together. There is some data that Uber exclusively have that Lyft does not like cash enabled, upfront fares, and sharing. I made a separate object property to store this exclusive data, and can be modulated to add other share riding services.
Dabbled a little bit with Vue filters to handle currency. It currently supports USD and CAD simple formatting such as padding numbers to the right of the decimal (10.9 to 10.90) and placing the right symbol for the currency. Eventually I will like to add other formatting such as commas for USD ($1000.00 to $1,000.00), but if I have to deal with numbers like that for a ride sharing service that is damn expensive for the rider.
That is pretty much the week of February 24th, 2019.