Integrating Google OAuth Authorization in my web-app - php

I am building a web-app where I need to access list of spreadsheets from Google Docs (of Google Apps)
I want to authenticate using OAuth.
How can I do it in my PHP application?
One important thing, I want to authenticated on my user behalf. My application will run in background, and user will get email regarding list of spreadsheets associated with his/her account. I don't want a script that will need user to enter his/her email-id and password everytime script runs.

First, here is an overview of OAuth usage with Google:
http://www.google.com/support/a/bin/answer.py?answer=61017
Next, here is a more in-depth overview of OAuth usage with Google: http://code.google.com/apis/accounts/docs/GettingStarted.html
Next, here is a sample of how to do 2 legged OAuth with PHP:
http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html
Finally, here is the Google Documents List API (that you will most likely need to use):
http://code.google.com/apis/documents/
Enjoy! (And remember to vote up if you liked this answer)

Related

Integrating LinkedIn API in PHP

I am trying to create a portal where users after login can search other members, update their own profiles etc. I want to integrate every users LinkedIn profile to the website so that when anyone is searching for a member, the results should be the as per the LinkedIn profile of that person being searched for.
Moreover I'm using PHP and MySQL database in the back end.
How to enable this feature in my website using the LinkedIn API ?
You would download a wrapper for php to interact with the LinkedIn API first....
LINKED IN PHP WRAPPER
Then from there you would create a database to store new users names, and ids' along with their l=LinkedIn email. Which will be the reference to their linked in profile.
Which you would give them the option to login via LinkedIn, with oAuth.
Some helpful links to get you started...
But if you don't know much about PHP or programming in general. This might all seem very confusing at first
TUTORIAL 1
Simple LinkedIn PHP library
Getting OAuth token

Is it still possible to use Google OAuth without plus?

I have a working php code which lets users login through Google Api.
The problem is, this code requires users to become Google Plus users.
I use the latest api located at http://code.google.com/p/google-api-php-client/downloads/list and still couldn't find out if I can use the same service for people who do not have and do not want to activate Google "plus".
update: I understand that this might be a 3rd party api question and I also think that this is a question about a popular 3rd party api and this question and it's answers may still help many people out there.
answer of the question: for quick reference, the answer is *Google_Oauth2Service* class
You can use Google OAuth as a mechanism to authenticate users without requiring that those Google users have activated Google+ accounts. See Using OAuth 2.0 for login. This approach relies on requesting the user's identity via the userinfo.profile or userinfo.email OAuth scopes.
You get advanced functionality and social capabilities if you use Google+ Sign-In, and if your users opt for that option, they will be prompted to upgrade their Google account. This approach uses the plus.login OAuth scope, which gets you identity information in addition to other API methods that can be called.
Choosing the approach that works for your app and audience is up to you.
As of june 2015, you have to use the google+ API to set up the sign-in (Other methods were deprecated).
If you want your user to sign-in without a google+ account, you need to specify "profile" instead of "https://www.googleapis.com/auth/plus.login" as the scope as explained here

Is there any good totuiral to facebook API and is it possible to get the friends list of the user in my site?

I want to build a website that you can login with your facebook account.
what tutorial or any good beginner's book is there on this issue.
Is there any good sample of source code for this use
can I get the friends lists of my users and split it to males and females?
what is the difference between GRAPH and Facebook API?
Facebook have a few methods for integrating facebook in websites, check out the Facebook for Websites tutorial.
You have a few ways to implement this using the tools facebook provides you with, for example you can use the Registration Plugin (you can find code & examples in this tutorial).
If you have a facebook application and a user authorizes your app, then you can get the list of his friends. Without asking for specific permissions though all you will get is the their names/facebook ids. If you need more than that check out the Permissions documentation (2nd column refers to the friends).
Both things are the same, you just gave them different names.. It's called the Graph Api, there's no other "facebook api". This graph api also supports FQL in case the api alone is not enough for what it is you need.

Programmatic login to Google Data API

I'm building an application which will basically be an interface for my Google Finance account. Several people will use. I have just started to research on how to do this, and one thing that immidiately seems like a hurdle is Google's oAuth system, seemingly designed for the case where each user logs into his account himself.
The usual proceeding as I understand it is that from my web application, the user gets redirected to Google's page, where they enter their information, and then are sent back. I will wind up with an authorized token that I can use to pull the data that I want.
BUT, now, as my application will ALWAYS and ONLY pull data from my account no matter who is logged in to my application, I need to always be authorized and it needs to happen programmatically without the user ever knowing.
Is this possible?
If this is designed to be an interface to YOUR Google Finance account that several people will use, then OAuth is probably not the answer you're looking for.
OAuth would allow your app to pull information from your users' Google Accounts, whereas ClientLogin would allow your application to pull data from a single account.
Check the Google Finance API for more details and examples:
http://code.google.com/apis/finance/docs/2.0/developers_guide_protocol.html#ClientLogin

Sending Facebook messages through their API - possible?

I'm building a web app for a client where members of general public can create an account. Client would like to be able to use my app to send Facebook messages to those members.
Note that my app is a standard LAMP site and NOT a facebook application, nor is there the desire to create one; delivering messages to members' FB inbox is the only goal.
Is this possible, using the FB API or any other way?
In short the answer is no. Facebook do not give you the ability to do this to prevent spam. You could post to all of your user's feeds however?
What you would need to do is:
Register facebook app to get access to FB API. You don't need to have actual facebook app, just use received API key on your standalone site.
Create authentication process on your site so users would be able to connect with your site through facebook.
Ask users for additional extended permissions during authentication to access their email, as it is not something that could be accessed without user's explicit permission.
That's the bare minimum for this task.

Categories