Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm under the impression that OAuth is for authentication between three parties. Does it make sense to implement OAuth in a context where there is just a client and server.

We have a server, and a client (HTML/javascript). Currently we authenticate via the normal "post credentials to server, get a cookie, use cookie to authenticate all subsequent requests" method. Will implementing OAuth be a benefit in this situation?

share|improve this question
I'd go with OpenID under these circumstances. – Gary Rowe Jan 30 '13 at 17:03
@GaryRowe: OpenID is simpler, but the basic structure that one service uses identity proven by another service remains. – Jan Hudec May 28 '14 at 11:42

Oauth supports different Grant Types for the differing communications you're asking about.

Here is an example in a PHP library , of a different grant type or two:

Client Credentials Grant Type Trusted Clients and UnTrusted Clients

The Client Credentials grant type is used when the client is requesting access to protected resources under its control (i.e. there is no third party).

# using HTTP Basic Authentication
$ curl -u TestClient:TestSecret -d 'grant_type=client_credentials'

# using POST Body
$ curl -d 'grant_type=client_credentials&client_id=TestClient&client_secret=TestSecret'

You'd get back an access token (like your cookie) and use that on all subsequent calls.

Implicit Grant Type

The Implicit grant type is similar to the Authorization Code grant type in that it is used to request access to protected resources on behalf of another user (i.e. a 3rd party). It is optimized for public clients, such as those implemented in javascript or on mobile devices, where client credentials cannot be stored.

Source :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.