juju/api: use the environuuid if set

Fix a bug where the wrong tag was used when caching api credentials.