artsy/eidolon — pull request #29 by AshFurrow (2014-09-12 23:00:09+00:00)
Title: [WIP] @orta => Basics of transparent self-app-token-fetching API client

There is a call to `.FeaturedWorks` ("/api/v1/sets") in the app delegate as a proof-of-concept.

The basics of use are, instead of calling `ArtsyProvider.request(.Whatever)` as you normally would, you just call `ArtsyProvider.XAppRequest(.Whatever)`. It'll check if the XApp token is present and hasn't expired yet, transparently fetching a new one if required, and signing all non-XApp token requests with the XApp token.

Work-in-progress because I still want to address:

- [ ] Needs tests.
- [ ] I don't like the `ReactiveMoyaProvider` extension instance method referencing `ArtsyProvider`, an instance of that class.

![](http://i.imgur.com/UT69wID.gif)