Arrays.sort(scopesCopy);
scopesKey = Arrays.toString(scopesCopy);
}
String lastScopesKey = (String) environment.getAttributes().get(GET_OAUTH_USER_SCOPE_KEY);
if (response == null || !Objects.equals(lastScopesKey, scopesKey)) {
GetOAuthUserRequest request = new GetOAuthUserRequest();
if (scopes != null) {
for (String scope : scopes) {
request.addScopes(scope);
}
}
Boolean requestWriterPermission = (Boolean) environment.getAttributes().get(
REQUEST_WRITER_PERMISSION_KEY);
if (requestWriterPermission != null && requestWriterPermission) {
request.setRequestWriterPermission(true);
}
byte[] responseBytes = makeSyncCall(GET_OAUTH_USER_METHOD, request);
response = new GetOAuthUserResponse();
response.mergeFrom(responseBytes);
environment.getAttributes().put(GET_OAUTH_USER_RESPONSE_KEY, response);