I am trying to figure out how to implement the following authentication flow:
- The user accesses the web application (most likely it will be written using Ruby on Rails) and authenticates (for example, username / password).
- The client uses data through AJAX provided by the RESTful API built on the Google App Engine (Python, webapp2).

Requirements:
- Only authenticated web application users (Rails) should have access to the API hosted by App Engine.
- Users can have different roles in a web application (Rails), and the API (App Engine) needs to know which roles are associated with a given user in order to restrict access to certain data.
- API (App Engine) AJAX, - (Rails).
, . OAuth ( OAuth2) API? OAuth App Engine - (Rails) API ? , - (Rails) OAuth? ?
. OAuth .