dcblogdev / laravel-microsoft-graph

Laravel package for Microsoft Graph API (Microsoft365)
https://dcblog.dev/docs/laravel-microsoft-graph
Other
124 stars 53 forks source link

difficulty with this endpoint #8

Closed ApuRed closed 4 years ago

ApuRed commented 4 years ago

I am trying to use this endpoint to be able to add a student to a class, but I get an error, I have tried modifying the lines in almost every way, I have tried to understand the API but it is still somewhat complicated for me, I have looked for the error it sends in many places, without any success.

$Estudiante = [
"@odata.id" => "https://graph.microsoft.com/beta/education/users/{student_id}"
];
$Resultado = MsGraphAdmin::post('education/classes/{classes_id}/members/$ref', $Estudiante);
dd($Resultado);

here the error

{#1252 ▼
  +"error": {#1230 ▼
    +"code": "AccessDenied"
    +"message": "Required claim values are not provided."
    +"innerError": {#1261 ▼
      +"request-id": "a7c74dd9-7fb4-4c6b-b3c9-6c6398916001"
      +"date": "2020-06-03T14:42:39"
    }
  }
}

I turn to you since I am using your library which helps me a lot with the other APIs that I am using from Microsoft.

dcblogdev commented 4 years ago

Hi, you may have already seen this but this post looks to answer this https://stackoverflow.com/questions/49415969/accessdenied-required-claim-values-are-not-provided-when-accessing-education-us

also have you set these scopes in the permissions:

EduRoster.ReadWrite.All plus Member.Read.Hidden

I assume {classes_id} is replaced with the actual class id?

ApuRed commented 4 years ago

Thank you very much, I did not understand how to do it, that link helped me a lot, seriously thank you very much

Sorry for the English but I use the google translator, I speak Spanish.