AngularJS Logo

AngularJS: Send auth token with every request

AngularJS is an awesome javascript framework. With it’s $resource service it is super fast and easy to connect your javascript client to a RESTful API. It comes with some good defaults to create a CRUD interface. However if you are using an API, which needs authentication via an auth token, you might run into issues: The resource factory creates a singleton. If you do not already have an auth token when the factory is called, or if the auth token changes afterwards, you cannot put the auth token as a default request parameter in the factory. ...

July 5, 2012 · 6 min · Nils

CORS API with OAuth2 authentication using Rails and AngularJS

Introduction For my latest project PomodoroEasy I wanted as much decoupling of the web client and the server as possible. So the server only provides a RESTful JSON API to feed the client. All the templating, views and business logic are done clientside. Furthermore I wanted them to be provided on different servers and domains. The client is a single page webapp, which resides as a static project on it’s own server. It is not sent from the Rails API server. ...

June 23, 2012 · 10 min · Nils