Fix KeyError : access token & Refactored code

KeyError on access_token when accessing the google api.

This exception is also raised in the github example and probably some of the other examples.