Whats the difference between Facebook Php API and oAuth Authentication? - php

As the title of the question suggests; whats the difference between Facebook Php API and oAuth Authentication?
It seems there are two methods for authentication wtih Facebook. One is the oAuth 2.0 which can be seen here. The other one is the Facebook PHP API (which also uses oAuth since V3)
Is there a difference between these two?

Yes, a big difference. oAuth is just one thing the PHP API can do. The PHP API can get stats, friends list, post to walls, send request, etc. Of course, most things can't be done with the PHP API until you authentication, using oAuth.
One way to think of it is that oAuth is the login, PHP API is how you interact with Facebook.

Related

Can you get a short-lived OAuth 2.0 access token for Firebase in PHP?

i am currently working on a Project with Firebase and i am trying to Implement the Firebase Cloud messaging service. I manage to make it work with a combination of PHP and Javascript (Javascript sends a Requiest to the server, where php makes a call to the Firebase API to send out a Notification).
The problem here is, that the code i use is for the old version, so its not using the HTTP v1.
When i looked at the docs on how to upgrade to the new version, i found out you need a short-lived OAuth 2.0 access token.
Thing is, the docs only show how you can get it via node.js, java, python, c# and go.
So my question is, is there a way to get the short-lived OAuth 2.0 access token with php or do i have to use something like node.js for it?
I'm not sure I fully understand your requirements, but if you want to send FCM notification from a PHP backend, I'd suggest checking out this (unofficial) Admin SDK for PHP (Disclaimer: I'm the creator of that library)
In its current state, you would need a Firebase Service Account (with Admin access) to be able to send notifications with it, but I'm currently working on a feature that will allow you to retrieve an OAuth access token for a given user (https://github.com/kreait/firebase-php/pull/390) in case you really need this.
I'd like to invite you to join https://discord.gg/nbgVfty (the Discord-Community around the PHP Admin SDK) to discuss your use case and process further.
Even if the SDK is not for you, looking through the code might could give you some ideas...
An alternative could be to use the Google PHP Api Client Services library, in which you can find a FirebaseCloudMessaging service.
I hope this helps!

'this application will be able to post tweets for you' how to achieve this?

I've created a twitter app (using PHP as the programming language) that requires the authorization from the users. This app has 'read and write' access. How do I tweet on my users behalf through this app. I've also searched a lot on the internet but to no avail. I'm a beginner and this is the first app that I've created. So I don't have much idea here.
First you use the OAuth 1.0A flow to obtain an access token representing the Twitter User's authorization of your application to work on their behalf.
Once you have this access token, you use it in OAuth 1.0A signed requests to Twitter's statuses/update API method, which is the API method that creates tweets. https://dev.twitter.com/docs/api/1.1/post/statuses/update
It's best to use a library to perform these actions, such as tmhOAuth for PHP: https://github.com/themattharris/tmhOAuth
There are examples for negotiating tokens and tweeting using tmhOAuth here: https://github.com/themattharris/tmhOAuthExamples
If you're new to OAuth, this guide is pretty helpful: http://oauthbible.com/

Create own oAuth process in Codeigniter?

I am developing an API using Codeigniter and Phils RESTserver.
I need to have authentication working with oAuth but I cannot find a library
that works with both Codeigniter and MongoDB.
Is it simple to create the oAuth process myself? I know it is hard to answer
not knowing my level of expertise.
This is my understanding of the oAuth process.
User clicks on link and are redirected to the servers login form.
User will be asked to authorize the developers app.
If he does authorize it he is redirected back to the developers website.
On this website the code that he got from step 3 will be exchanged for an access token.
Developers app will now be able to access the users account on the server.
I know there are parameters to be sent along with the requests like client_id and client_secret and redirect URL. But my question is. Is it this easy to implement an oAuth server? Just create the classes and functions? What else are the requirements to
be able to call the process a true oAuth authentication?
Thankful for all input!
Have you had a play with this?
https://github.com/alexbilbie/CodeIgniter-OAuth-2.0-Server
Alex has also written a Mongo library, so if his server doesn't support Mongo out of the box then just have a play with that. Just because your API is in Mongo though doesn't mean the api keys, tokens, etc HAVE to be in Mongo too, but they easily can be.

Windows Live oAuth wrap for contacts?

I would like to know if the oAuth wrap authentication facility by windows live is just for messenger connect or what?
Can it be used for Live Contacts API?
I am trying to fetch addressbook from live contacts. How can i do that?
Microsoft's msdn documentation on various APIs sucks to the core!! They doesnt even have any specific working PHP example for this.
Can somebody redirect me to the well organized documentation/tutorial on this?
Not sure if you've figured this out yet, but I am looking into it as well. I don't have a working sample yet, but the answer is YES, OAuth WRAP can be used for the Live Contacts API as well as any other Messenger Connect APIs. It's actually fairly straightforward if you've used OAuth before. You would obtain authorization as with any other provider (eg. Facebook, LinkedIn, Google, etc.), and then obtain an access token:
http://msdn.microsoft.com/en-us/library/ff750952.aspx
You would then pass that access token in the Authorization header (curl_setopt, CURLOPT_HTTP_HEADER) and continue with the REST call as if you had authorized using the Live SDK.

php webservices to twitter

can i tweet from webservice to twitter using oAuth?
Could anyone please tell me what I should do?
The following PHP Twitter libraries support OAuth:
twitteroauth
twitter-async
Twitter API CodeIgniter Library
They are fairly similar: about the only difference is that twitter-async uses asynchronous Curl calls to Twitter which may be faster depending on what you are doing with the Twitter API.
If you have a one to one mapping between a twitter account, and your web service, you still need to authorize an access token at least once.
Once you have an authorized access token, you can make twitter requests as needed.
Just a guess that this is what you want though...

Categories