Implemented application oauth2 authentication flow.