Integration of OAuth2 into a distributed system