microsoftgraph / msgraph-sdk-ruby

Microsoft Graph Ruby client library for v1 APIs
https://graph.microsoft.com
MIT License
99 stars 68 forks source link

Update example #129

Closed srtippan closed 1 year ago

srtippan commented 1 year ago

Updated README example, since the given example does not work.

Scope update to use 'https://graph.microsoft.com/.default' rather than 'User.Read' as we get the following error

OAuth2::Error (invalid_scope: AADSTS1002012: The provided value for scope User.Read is not valid. Client credential flows must have ) scope value with /.default suffixed to the resource identifier (application ID URI).
Trace ID: 44e61acd-c6b7-483f-b3bc-9a6164cc3e00
Correlation ID: 11c0af7b-eb8d-4555-9fdc-2002a11730b4
Timestamp: 2023-07-11 17:05:18Z
{"error":"invalid_scope","error_description":"AADSTS1002012: The provided value for scope User.Read is not valid. Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI).\r\nTrace ID: 44e61acd-c6b7-483f-b3bc-9a6164cc3e00\r\nCorrelation ID: 11c0af7b-eb8d-4555-9fdc-2002a11730b4\r\nTimestamp: 2023-07-11 17:05:18Z","error_codes":[1002012],"timestamp":"2023-07-11 17:05:18Z","trace_id":"44e61acd-c6b7-483f-b3bc-9a6164cc3e00","correlation_id":"11c0af7b-eb8d-4555-9fdc-2002a11730b4"}

Update example to query users by id, since the client-credentials cannot get user specific data.

MicrosoftGraph::Models::ODataErrors::ODataError (MicrosoftGraph::Models::ODataErrors::ODataError)