AFNetworking/AFOAuth2Client — pull request #28 by booiiing (2013-04-11 09:53:25+00:00)
Title: Automatically refresh access-tokens

Fixes issue #12.

WARNING: *This pull-request depends on #27 and will leave you with broken code if you don't apply both.*

By injecting an extended `failure`-block, the client checks for expiration of the cached token and tries refreshing it.
If a new token can be obtained, the original request is repeated with the new authorization-header.
If no new token can be obtained or something else goes wrong, the original `failure`-block is called, handing down either the original error or the error that came up when refreshing.