Adapt new changes in GateIn API for OAuth. Add more null checks