Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How the browser should communicate with our API
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Milon  
View profile  
 More options Sep 17 2012, 6:27 pm
From: Dan Milon <danmi...@gmail.com>
Date: Tue, 18 Sep 2012 01:26:19 +0300
Local: Mon, Sep 17 2012 6:26 pm
Subject: How the browser should communicate with our API
Hello Community,

Sorry for going off topic, but I'm sure there are people here who could
help me. Although most of the stuff described below are build in node,
my question is more of an architectural one.

I'm developing a public HTTP backend API for a service. On top of that,
there is a web app that has users log in, and should use the backend API
to fulfill user requests. The API supports OAuth2, and the web app is a
single page app, with loads of javascript.

My concern is how the browser and the web app should talk with the API.
I found two possible ways.

## Browser directly uses the API

When the user enters his credentials to log in, the web app passes them
to the API and is given an OAuth access_token, which is directly passed
to the browser and stored in some cookie. Then every request to the API
is made directly from the browser through JSONP. When the user logs out,
the web app destroys the session.

## Browser talks to web app, which talks to the API

When the user enters his credentials to log in, the web app passes them
to the API and is given an OAuth access_token. A session is created with
the User and the access_token is stored in the session. When the browser
needs to talk to the API, it goes through the web app. The web app uses
the access token in the session, calls the API, and delivers the
response to the browser.

Both ways have pros and cons with performance and security trade offs.
What do you think?

Thanks a lot,
danmilon.

PS: from what I've seen, twitter uses it's public API directly from the
browser, but passes session cookies for authentication. That means their
API also supports cookie sessions?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Rodger  
View profile  
 More options Sep 17 2012, 7:06 pm
From: Richard Rodger <richard.rod...@nearform.com>
Date: Mon, 17 Sep 2012 16:06:21 -0700 (PDT)
Local: Mon, Sep 17 2012 7:06 pm
Subject: Re: How the browser should communicate with our API

"it depends" :)

Apigee had a good article on this recently:
http://blog.apigee.com/detail/api_authentication_and_how_it_got_that_...

Richard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »