HI @iz111,
I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.
By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:
[Upload a file to SharePoint Online using Graph access denied issue]
Issue Symptom:
Upload a file to SharePoint Online using Graph by bearer token. Returned access denied error.
Solution:
The permission granted in Azure app delaied. The code works properly after the permission applied. Per my research, the permission will takes minutes to hours to active. It depends on the size of your tenant, the big tenant takes much longer than the time of the small tenant.
You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!