updated refresh to support non base64 encoded