I implemented exactly like that for my AZD (azure DevOps) few weeks ago, unfortunately not all variants and external tools support oath2. For example azure DevOps server (on prem) and also Codecov, so I kept also the PAT as an option for the end user.
Also, just got a request from a user to allow authentication with azure cli so I guess I ll have to support that as well…
But the example of GitHub in the IntelliJ community was super helpful and revealing on how to support Oath2