I just recently experienced this error. I am on Office 365 so using the latest SharePoint version that is deployed on my tenant.
This occurs in the app-environment in one of the add-ins I am working on. A couple of weeks ago this wasn't a issue. I have already granted the add-in read permissions for "User Profiles (Social)" that should be enough to read the current user profile.
(1) This query worked before, but now it gives me access denied error:
System.UnauthorizedAccessException: Access denied. You do not have permission to perform this action or access this resource. https://coolcompany-e4b1dcb467653e.sharepoint.com/sites/dev/app/_api/SP.UserProfiles.PeopleManager/GetMyProperties
(2) For the sake of testing this too had the same outcome as (1):
If I test with the main domain, everything is fine, as expected:
So the issue seems narrowed down to unable to access SP.UserProfiles.PeopleManager from the app environment.
Note that whilst writing this post, I noticed that simply CTRL+F5 refreshing the page from the (1) example URL, most of the time it would show me access denied exception, but then it would suddenly show me the expected data. Same behavior goes for (2). This looks very odd, and it persisted trying other browsers and incognito/private modes to make sure there were no cookie issues.
Right now I'd like to hear from others that might have the same issue or similar. It's important to me that this doesn't remain unnoticed.