Good tutorial on Google Drive SDK and OAuth 2? [closed] - oauth-2.0

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to be able to read in files on a website from a Google Drive account, which has made me pull my hair since the documentation for Google's services is so overwhelming (for me it is anyway, I have little experience with working with SDKs and APIs). I also realize that I need to use OAuth 2 authorization to grant access to the files. Any good ideas on where to start?

Your first step is to decide whether you will be doing the Drive access from a Javascript client, or from a Web Server (php, Java, etc). OAuth is very different depending on which flow you will be using.
Your second step is to decide whether or not you want to use the abstraction libraries, or program directly to the HTTP API.
There are pros and cons to both methods. Personally I elected to use the low level HTTP APIs for the following reasons:-
They are more stable. The libraries are prone to breaking changes which can frustrate beginners. Often you will find example code which won't compile v. the current library versions
The less third party code I use, the easier it is for me to maintain
I find some of the OAuth abstractions somewhat bizarre, especially in the error handling
If you get errors, they can be difficult to resolve at the SDK level, and you find yourself needing to trace and hence understand the underlying HTTP API anyway.
Many of the libraries are labelled Beta, which excludes them from production use in my company.
If you choose to go the HTTP API route, then there are really only three resources that you need.
Firstly, you need to understand OAuth https://developers.google.com/accounts/docs/OAuth2
Secondly, you need to validate your understanding using the OAuth playground https://developers.google.com/oauthplayground/
Finally, you can learn and watch the Drive API at (eg) https://developers.google.com/drive/v2/reference/files/list#try-it
Make sure you treat OAuth and Drive as separate topics. Understand OAuth first, then tackle Drive.
I'm sure a lot of people have success using the libs, so I won't write them off completely. They're just not for us for the reasons above.
One more tip, remember that OAuth is about Authorisation, not Authentication. So you still need to do your authentication and user/session management. Having said that, OAuth does spit out a user token as a by-product, so there is some overlap. My point is really that you need to roll your own user/session management.

On these slides, there is an example at the end using OAuth.io to sync file with google drive, it might help you
The source code of this demo is available on github

There is a nice sample code you can learn from this site. It include a demo html files and the api is purely done in javascript.
https://bytutorial.com/tutorials/google-api/introduction-to-google-drive-api-using-javascript

Related

Website development - Which tools and languages? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
for a project I will need to develop a website. The problem is: This is the first time for me.
I am currently planning and drawing the outlines and also trying to find out which technique will suit the project best and how to approach this task.
The website should retrieve data from an API by using RESTful HTTP-Commands and present the results to the registered user.
My programming experience so far is mainly C++ and some C#/.NET which I used for the creating the API.
So, which language and script do you think would suit best? I have looked into ASP.NET MVC a bit because of my previous experience with .NET. Is that a proper choice?
Apart from
that, I would prefer a graphical designer for the HTML-coding. What tools would you use? I looked into Google Web Designer, but I was not quite persuaded. What would you recommend?
Thanks in advance!
Eteokles
I agree with Sami, if you have basic knowledge in CSharp/.Net it is not a bad idea to use ASP.NET MVC/API to setup your project. But you should bear platform dependence in mind if you are not using .NET Core, which is actually in Version 1.0.0 RC 2. So if you use ASP.NET 4 you will have to use a Microsoft Server to deploy your application. If that is no problem for you, then I would recommend to have a look at Microsoft Virtual Academy. Developing ASP.NET applications with Visual Studio is a pleasure, you have great debugging tools and you can create Unit Tests to test your application.
Unfortunately there is nothing like a graphical designer for your HTML frontend in Visual Studio. But if you are using Bootstrap you can reach your design goals really fast. Also Bootstrap is "mobile first" which means, that even if a user accesses your Website over a mobile device (Tablet, Smartphone) the site will look great. The basic ASP.NET 4 MVC template comes with a Bootstrap layout, you could build upon.
If you want to enable users of your application to create user accounts you can choose the ASP.NET MVC template with "individual user account" ASP.NET Identity
In conclusion I want to provide you another link where ASP.NET is compared to another very popular and easy to learn language for developing websites PHP vs. ASP.NET. I would recommend ASP.NET after using PHP for years, because thinks like asynchronous programming and using Entity-Framework to handle your database needs.
I would also recommend you to do further reading on the pros and cons of different tools and languages and after you have a general overview over the available solutions you should compare which language and which tools match your application needs most. Happy coding.
Based on your experience/knowledge, ASP.Net, MVC and API seems a good to go option. You might need to understand Javascript/jQuery and JSON to communicate with API. It's pretty simple like:
$.getJSON("http://localhost/api/products", function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
})
For UI, Bootstrap is always a good choice and easily get your layout at
Layoutit
For Web API, a good tutorial found at Web API in ASP.Net MVC
Hope this helps!

I wanna fetch my blogposts from my website, to my iOS app. What knowledge is required to do this?

My website is up and running with support from Wix.com, I used the drag and drop builder to set it up and I didn't need to do any Client side/Server side programming for it to work.
What should I do if I want to keep the app updated with the website as soon as I upload any article/post on the website.
Consider taking a different approach and migrate to a platform/architecture that better suits your specific case.
My suggestion would be Microweber - it's a pretty advanced platform for websites with CMS and e-commerce features. It's been around for quite some time (3 years or so) and I'm using it for about 12 live active projects.
It's very neat if you plan to write custom code as it's based on Laravel and everything is easily extendable.
However, I'm using it mainly because of the support. Although it's free and open-source the team is online most of the time and have replied to my every request so far.
This is critical for me as many website solutions come and go and none is
perfect. What makes this one better is the reaction time and adequacy.
This is my personal opinion with regard to the fact that it's very hard to pick one solution among so many given that you didn't state more specific requirements.
It cannot be done without any server side scripting and backend database for the mobile app. you need to develop database for it.and then you will need to develop web service for the passing the data between mobile and backend.
A dirty way to do this would be through an HTTP request that reads HTML. However the best way would be through Wix's REST API.
Edit: I'm regards to keeping the app updated, you're going to need a backend service that is consistently checking for updates.

Is there any place for MVC when you use JS view models with knockout? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've been in some discussions lately and the talk is about moving over to ASP.NET MVC and Knockout for future work on a product that is currently ASP.NET web forms. This product has many of the characteristics of the general current definition of a SPA.
I've never quite seen how MVC actually fits in when you start generating all your views with JS view models which get their data from calls to JSON web services.
Is there a "sweet spot" that leverages the best parts of Knockout w/JS models and JSON and the MVC framework?
Here are some things that I've been thinking about this (a little random - just seeing if I can spur on some discussion/answers):
When would you use Knockout vs. Razor? Knockout generates the view elements at run time on the client browser. Razor runs as part of the server request before the client receives the response. Are there times that one is clearly better than the other or does it come down to personal taste?
Is there value in keeping more code under the guise of C#/Razor for the purpose of code completion? Also, when exceptions get thrown, stack tracing to compiled code seems easier than JS debugging.
Is it better to completely separate the view from the back-end by creating a blank ASP.NET application and an independent Web API project?
Lots of great questions, I'll share some of my thoughts on the subjects. (Questions have been paraphrased):
1) Is there a place for MVC in a Knockout world? - Absolutely. MVC is a lot more than just Razor. Server side routing, Areas, Authentication, and more, are all provided by MVC. So in my mind, I can still use MVC for all the "admin and organization" but still have all my Views be primarily (but not necessarily completely) AJAX driven. I have discussed using MVC and KO together on SO before. I also have a video dedicated to that topic at WintellectNOW dot com.
2) When should I use Razor? - Let's actually switch up the terminology. It really isn't about Razor vs. Knockout: it's really about server-side vs. client-side rendering.
So when should you use server-side rendering? One ideal time for this is when you are loading data that only has to be done once when the page is initialized. For example, if you have a list of States for a drop down, and that list is extremely unlikely to change, go ahead and load that on the server side. Why turn around and make another request back to an API in that case? I would reserve those calls for dynamic or context sensitive data.
3) Is there value in keeping more code in C# for tooling purposes? - IMHO, no. It's true that debugging JS can be painful, but that is not enough justification for me to disregard all the awesome things I can do client side. It's worth the occasional frustration to provide a better user experience.
4) Should I move Web API to a different project to keep the code separate. - It completely depends on the needs of the project. If the Web API project is going to service multiple applications, then YES it should be in a separate project. That will also put it on a separate DOMAIN, SUB, PORT, or something to differentiate it from the rest of the Web app. Doing so introduces Cross Origin Resources Sharing (CORS) issues. CORS is a particular hell I wouldn't go through unless absolutely necessary. If your Web API is only going to service your single web app, do yourself a favor and keep it in the same project.
As with everything else, a lot of this comes down to personal preference. Mine is to use Server side for managing the bigger picture of my app, and client side for all the UI/UX.

Building the back-end server for an iPhone App

I'm looking at building a simple login-based iOS application that needs secure access to create, read, updated and delete data from a MySQL database - with certain actions available to specific users based on roles.
I've done some research and it looks like I need to build a RESTful Web service which provides Web Services which the iPhone app calls to access the data.
I have very little experience of web services development, are there any books/tutorials that are worth checking out? Is it worth looking at a web framework, rather than start from sractch?
I've done some basic web development in PHP/Python so would prefer to build in that I think..given that hosting it would be relatively cheap..
Have done some basic C#/Java; would it be worth looking at these instead? I tried creating a simple ASMX webservice but most of the examples cite using a MSSQL server, not sure if that is the way to go though.
Use a framework. No point reinventing the wheel and giving yourself a headache. A good PHP based solution would be to use Drupal to build the backend using the Services module to provide data via webservices. Drupal is so flexible and so popular now, that you can get a lot of what you want done without any code at all.
Roughly:
Install Drupal 7 on a webserver according to the instructions
Install the Services module
Design the entities that will make up your MySQL database
Tell the services module how you want to expose things
Some examples of API calls are here.
A case study of someone else who has used Drupal as the backend for iPhone/Android is here.
You will have a learning curve to get your head round Drupal, but you'll have one anyway to get your head around webservices and the benefits you gain from having everything else Drupal offers are enormous, e.g.
The difficult bits are already done for you, so the amount of code will be massively reduced, if you even need any at all
Using Drupal's hugely flexible entities system, you can design a flexible and extensible mysql database scheme using the web based UI, which will be ready to work with any of Drupal's other modules, so you can expand add features with minimal effort in the future
There's an enormous community of people who can help you and the forums on drupal.org are very active
You would have a great UI for users, in case you ever need to give them access to their data through a normal website interface. Drupal has loads of pre-built themes (I recommend Omega) which look awesome and again, little to no code is needed to get a whole site ready made along with HTML5, standards compliance etc.
Drupal provides you with ready-made modules to provide access control via roles, as well as everything else you can imagine e.g. managing a mailing list for your users, providing you with usage statistics, admin interface for user and role management etc.
Drupal use is exploding globally and there's a serious skills shortage, so you'd be even more employable :)
First, it's not compulsory that you use a REST web service. It's just that WS si more or less standard for web-based applications.
I'm not really familiar with PHP, but in python you have django-piston. On the IOS side you have restkit to pair the server with.
What I could say from my experience is that writing a prototype in django is quite easy and you can definitely use this to develop your app.

ASP.NET MVC Scheduler open-source? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
.NET MVC Scheduler/appointment open-source?
Thanks!
Our team had an MVC 5 project recently with this need. The project required the ability to display a calendar of events from a database as well as add and delete existing calendar items. We looked at DayPilot Lite's & Dhtmlx's JavaScript version 4.1 open source versions.
What we found
Both have JavaScript versions and .Net WebForms and/or MVC integrated versions however for our project we desired the JavaScript versions over the MVC integrated versions as we felt it was cleaner and fit more with our development model (We don't tend to use 3rd party integrated controls). JavaScript was the only free version offered by Dhtmlx while DayPilot offers the lite open source version for WebForms and MVC.
Both have nice tutorials available on their site and on various sites like code project.
What we chose
We used dhtmlx's JavaScript Event Calendar / Ajax Scheduler in an ASP.Net MVC 5 app as it had a few more features in it's open source version that we desired. Namely the color coding option was ready to go out of the box and we found the API very flexible, exposed events and customization options to be very powerful. We have been very happy with it and found it was easy to use their documentation site and samples site to figure out all that we needed to do. We did not use their data connector as we found straight AJAX calls worked easy enough for our scenario.
Getting started with dhtmlx
Here's a couple of articles on code project that we used to get us going with dhtmlx.
http://www.codeproject.com/Articles/148500/Event-Calendar-for-an-ASP-NET-MVC-Application
http://www.codeproject.com/Articles/249921/How-to-Build-a-Room-Booking-Calendar-with-dhtmlxSc
In case the links stop working the author is Stas Wolski for both of them.
Both examples are old but still effective. Finally, we used their online demos (can be downloaded) and online documentation site as well.
Knowledge share
One of our biggest tricks to the calendar was the date format matching (or mismatch in our initial case).
We used the format of scheduler.config.xml_date = "%m/%d/%Y %H:%i".
For dates coming from our MVC View Model (VM) we made sure to convert them to string formats of short date (#Model.StartDate.ToString("d")) if it was a date in the VM.
If the VM passed a date as a string then we made sure the controller used the following format example (item.StartDate.ToString("MM/dd/yyyy HH:mm:ss")).
Some potential helpful API's we used that might just be of use.
Reacting to calendar clicks - take a look at scheduler.attachEvent
Changing the Hours Scale look - take a look at scheduler.templates.hour_scale
Need to customize the view of different event types - take a look at scheduler.renderEvent and scheduler.templates.event_class
Hiding/Ignoring Weekends in the calendar - take a look at scheduler.ignore_week
Need to have a confirm dialog for a calendar action - take a look at scheduler._dhtmlx_confirm
Minifying Issue
We did find one gotcha with the JS version and MVC in particular that we didn't resolve. If you bundle and minify the dhtmlx's scripts the scheduler breaks as the scheduler object is renamed and becomes undefined. We simply setup the scripts to bundle but not to minify by using Bundle instead of ScriptBundle.
bundles.Add(new Bundle("~/bundles/dhtmlx/calendar").Include(
"~/Scripts/dhtmlx/dhtmlxscheduler.js",
"~/Scripts/dhtmlx/ext/dhtmlxscheduler_limit.js",
"~/Scripts/dhtmlx/ext/dhtmlxscheduler_minical.js",
"~/Scripts/dhtmlx/ext/dhtmlxscheduler_readonly.js"));
I'm sure there is a way to solve that but we weren't too worried about this in our case as this part of the app was not going to be getting high amounts of traffic....
Check this
http://www.codeproject.com/Articles/404647/AJAX-Event-Calendar-Scheduler-for-ASP-NET-MVC-3-in
I will use it in next project

Resources