Google Drive API Application Data folder, is it realy that difficult? - javascript

I want to store some application data on the google drive, for example to remember settings the user have made. Normally I will use cookies for this or the localStorage of the browser but this is browser depended and limited (storage size).
I google for some information about this functionality but didn't found something useful except the example of google itself. In this example (found here: https://developers.google.com/drive/appdata) they explain how to store some information. To me it looks more like sending an e-mail and they didn't explain how to replace some data. Quite complicated if you ask me.
I wonder why it must be that difficult to store a simple boolean, integer or string like you can do with cookies or the localStorage object. I doesn't have to know where it is located, just simple, you alter an identifier and a value, that must be it.
Does have somebody an example that makes this function easier to use? I mean is this the only way to do it? Does somebody has some experience with saving appdata?
Or does anybody knows a class that can simplify those things (like the PHP version)?

If you wish to store data in the users Google Drive, yes, it is that complicated. You are going to have to go through the OAuth2 process or one of the other handshake methods Google allows. However, if you wish to store that data into your own Google drive, which doesn't sound smart but I cannot tell from your question, you could make the process a lot easier because you could hard code your username and password into the header of the api calls you make. Again, that is not smart or recommended but because OAuth2 requires HTTPS its not suicide.
I'm sorry but it is not clear what you are asking. Please more specifically state your problem, otherwise this is the best answer anyone could give.

Related

Jsfiddle, codepen,Jsbin like front end - Javascript

I've created HTML/CSS/JS playground some well known playground like Jsfiddle, codepen,Jsbin etc.
i would like to know about, "how to save and load the workaround when the user logging in again?" i want user to save their workaround and let them resume from where they stopped.
what approach/idea/possible ways available for this?
do i need to know session/local storage very well?, if not, kindly share your experience. if possible pls share tutorial/example snippets or any other work around.
Note: before asking questions here, i have searched solution as much as i can. but not able to uderstand.
many thanks for any help.
Here are the options that you have:
If you want the data to be persistent for users then you need to implement user login and store their data in your database on the backend. That way they will still have it if they log in on a different browser or device.
If you use local storage then it will be saved only for that browser and and every time the user changes the browser the data will be lost.
If you don't want to implement your own backend then you can use something like Firebase or other solutions: see noBackend for more options and more info.
Another option is to use a solution described on StaticApps or unhosted which are very interesting ways to avoid using any backend logic in your apps but still keep some persistent state.

Fetching data from thirdparty websites

I work in a small healthcare related office and we often have to look up license and other related official numbers of physicians. We use websites that are free and available to the public to do so. I've been tasked with figuring out a way to enter in the physician name and then return the results from all of the websites in a single entry to reduce the amount of time spent going through each website. I'm familiar with javascript, php and ruby but by no means an expert. My question is, where should I start? I don't need anyone to write the code for me or anything, but I can't seem to form the right question to google for some answers. I'm fairly sure this is possible, just not sure where to start developing my idea. Any help would be appreciated.
It sounds like you need to do some screen scraping, which may or may not be allowed by the terms and conditions of the sites you're using - you should check that first.
If there aren't any restrictions on automatic retrieval and querying, you'll want to read up on PHP's cURL module, and simulate the form actions that are performed when you manually query the sites. You can use your browser's developer console to see what scripts and pages are called when you run queries - it's quicker than trying to work it out from the page source.
You'll get back the HTML from the pages, which you'll need to parse. Depending on the format on the page, a few simple regexes might do the trick, but you'll likely need to tailor them for each site you query.
Again, please double check that the sites you're using allow you to run scripted queries - if you're in any doubt, you should email them and explain what you plan to do, and ask if they're ok with it.

Storing user data for free

I will make a website where users log in to see the site's info organized in a way which is specific to each user, depending on the settings which they can set/save while logged in. But they won't be adding content or uploading anything. So I guess, it won't be a lot of data - just a couple lines of text for each user.
So, to start out, I'd like to use something free to store that user data. Dropbox or Google docs, my own compter.... I dont know.
And then later, when I get enough users to make the investment worthwhile, pay for a more legitimate solution.
My question is, in the meantime, what is the best way to store that user data? Should I use javascript and Google docs API to read/write to a spreadsheet?
What is going to be most convenient when my user base has grown enough and it comes time to move all that over to a larger system?
And are there any other concerns I should be thinking about?
Look into using a lightweight DBMS like MySQL. If you want, you can serve it locally using your computer, but don't expect it to handle a lot of traffic. It'd be better to find an old computer and use that as a server.
What is your hosting solution? Many include free mySQL databases which should be enough.
I would suggest using sqlite3 or something for a database setup. They can be very small files and easily manageable. In the long-run sqlite3 isn't a great choice. You would want to move to a heftier database assuming you rake in a lot of users.

How do I integrate user information into my Facebook application?

I wrote an application in Javascript that I put on facebook and would now like to integrate user information into the gameplay. I would like it to be similar to the way Words with Friends works, where the users' name and profile picture information are used to display the scores. To work best with the way my application works, being able to set the name and picture as variables seem to me to be the best way of doing this. Ideally I would also like to incorporate a way to select from a menu of the users friends which friend they want to challenge and send a request, and also record the users win/loss statistics. I have searched around and have not been able to find any guides on how to do this. If someone could point me to one or provide me with the code to do this that would be really great. I am somewhat new to programming and entirely new to Facebook applications.
Here is a link to what I have so far: https://apps.facebook.com/dotsandboxesgame.
This is a big topic and requires you to dive in the graph API which I assume you've looked at. In case you haven't here is the link
https://graph.facebook.com/
Basically, you need to ask a facebook user for permission to do certain things. What you want to be able to do with their account will be in line with what your application does. When a user accepts these permissions, you will have an access token that you can then use in a query string to query the graph API for any data available about that person (limited by what permissions you asked for from them).
It's then up to your code to interpret that data (JSON or XML) and then display it, interact with it etc.
Be warned, the Facebook API documentation can be quite vague. It is also hard to find certain topics, and Facebook constantly deprecates things. When they deprecate things they do tend to give a good amount of leniency for developers to update their code however.
Best of luck.

JSON in WP with GET/POST method (security problems)

So I'm working on some mobile application that will represent WordPress page.
Working it like web page, then spreading it to all mobile platforms using phonegap (mainly just taking webkit, moving all his functionalities, and putting that small webpage to applications)
Web is written in jQuery/JavaScript/html/css.
I come to some security problems. All data on original WordPress site is secret, and only members can see stuff from there.
And I need to get data in JSON format.
And there is my problem. :)
I can install (i did install) JSON api, and i can get every bit of data I want. But the problem is that anyone can (just type some "get" stuff in URL (for example: mysite.com/json/get_post/?id=1)).
I need to "secure" that data, and let it go only if the user who is asking for it is logged in.
What is the best solution?
I know there is a lot of security problems in this stuff. And only some encryption would be useful. But I need quick and easy solution that will at least make it harder than just typing url. :)
I found something about oAuth, but didn't really understand the way to use it. Any ideas? Any WordPress plugin? Anything?
Thank you. :)
What you are describing is an OWASP A4 - Insecure Direct Object Refernce vulnerability. Encryption does not solve this problem and is by no means the right tool. The problem is use access control. The user needs to login to the wordpress install in order to gain this type of information. Wordpress has a session system built in and you'll have to read up on their API documentation.

Categories

Resources