Hi @Yakun Huang-MSFT ,
I added some more permissions and one of them where listed in the roles claim. Now thougth, we have changed to the DeviceCodeCredentialFlow, but we still have the same error as before. The user that I have tested to log in has the Universal Print License.
I have also verified in the print section that we now are using the currect permissions in Azure, what permissions or else could there be to check?
I have been able to verify it via: https://learn.microsoft.com/en-us/graph/api/printdocument-createuploadsession?view=graph-rest-1.0&tabs=http
Bellow is a list of the permissions needed, including "Least privileged permissions" and"Higher privileged permissions".
For the upload session these are needed:
PrintJob.Create
To Create a print job these are needed:
PrintJob.Create
PrintJob.ReadWrite
PrintJob.ReadWrite.All
PrintJob.ReadWriteBasic
PrintJob.ReadWriteBasic.All
User.Read is then also set
Despite these permissions i get the error when using DeviceCodeCredential: "The token does not have one or more required security scopes."
Bellow is a sample response:
Header claims
{
"typ": "JWT",
"nonce": "hzASELsr2j8ih_b8btTg36z0W64MKoj48F5yuJmDH4E",
"alg": "RS256",
"x5t": "Mc7l3Iz93g7uwgNeEmmw_WYGPko",
"kid": "Mc7l3Iz93g7uwgNeEmmw_WYGPko"
}
Payload
{
"aud": "https://graph.microsoft.com",
"iss": "",
"iat": 1727791088,
"nbf": 1727791088,
"exp": 1727795763,
"acct": 0,
"acr": "1",
"acrs": [
"urn:user:registersecurityinfo",
"c1",
"c2",
"c3",
"c4",
"c5"
],
"aio": "ATQAy/8YAAAA7Ili1qSPuI3BH/RX6NOEazc+rijK4zYST6jErWWD3ZKYyxFBU8YNlq4u6uBkkNBq",
"amr": [
"pwd"
],
"app_displayname": "",
"appid": "60b2e375-e060-4161-bc19-0e6829004838",
"appidacr": "0",
"family_name": "Berntorp",
"given_name": "Oskar",
"idtyp": "user",
"ipaddr": "20.31.127.145",
"name": "Berntorp Oskar",
"oid": "",
"platf": "3",
"puid": "1003200238042542",
"rh": "0.AUgAOgkgeWU6ukqNVHayhISglAMAAAAAAAAAwAAAAAAAAAALAVI.",
"scp": "PrinterShare.ReadWrite.All PrintJob.Create PrintJob.ReadWrite PrintJob.ReadWrite.All PrintJob.ReadWriteBasic PrintJob.ReadWriteBasic.All User.Read profile openid email",
"signin_state": [
"inknownntwk"
],
"sub": "2comqiedgCLFTe-yAl9bFUnpebXij6FVgLDHNJb-rv4",
"tenant_region_scope": "EU",
"tid": "",
"unique_name": "",
"upn": "",
"uti": "r-FA7MR0s0u1HPKIgP8lAA",
"ver": "1.0",
"wids": [
"b79fbf4d-3ef9-4689-8143-76b194e85509"
],
"xms_idrel": "1 14",
"xms_st": {
"sub": "1Eq-_fDZGoSGuSeNYNKddDEY4vCOhxDh4LYHKsH6U-M"
},
"xms_tcdt": 1459855303,
"xms_tdbr": "EU"
}
Kindly
Oskar Berntorp