Example Rails  4 app demonstrating how to use doorkeeper gem with devise to secure api endpoints with 2 legged Oauth 2 authentication(Client credentials flow).