我使用这个 URL 来获取 id_token:
https://login.microsoftonline.com/common/oauth2/authorize?
response_type=id_token%20code&
client_id=MY_CLIENT_GUID_ID_IN_HERE&
redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fopenid%2Freturn&nonce=alfaYYCTxBK8oypM&
state=6DnAi0%2FICAWaH14e
Run Code Online (Sandbox Code Playgroud)
这个返回结果是这样的
http://localhost:3000/auth/openid/return?
code=AAA_code_in_here&
id_token=eyJ0eXAi_xxxx_yyyy_in_here&
state=6DnAi0%2FICAWaH14e&
session_state=xxxx_guid_xxxxx
Run Code Online (Sandbox Code Playgroud)
然后我使用id_token来查询 Graph(使用 POST man)

我已经看到这篇文章InvalidAuthenticationToken 和 CompactToken 问题 - Microsoft Graph using PHP Curl但没有意义。