What gives us the right to the tree of life?

What gives people the right to the tree of life and enter through the gates of the city (New Jerusalem) in eternity? Obeying God's commandments (not a dead faith). This verse doesn't indicate that sola fide (faith alone) is enough. Rather, it must be a saving/living faith evidenced by good works/obedience to God.

Revelation 22:14 (authorized KJV):
"Blessed are they that do his commandments, that they may have right to the tree of life, and may enter in through the gates into the city."