The reason I was not able to use identity was because I was trying to access it from a content script. I switched to a background script and it works now! Thanks Rob!
PS! You also need to have "permissions": ["identity"]
set in your manifest.json
.