You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't find any practical examples of how to apply logging to graph requests. When things don't work as expected it's really handy to be able to see what you are actually sending and receiving from the API.
I've tried the following but it crashes trying to create the client:
$this->tokenRequestContext = new AuthorizationCodeContext(
$this->config['tenant_id'],
$this->config['app_id'],
$this->config['client_secret_value'],
'NOT_AUTHENTICATED', // Auth code dummy value
$this->urlGenerator->generate('ms365_login_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
);
$tokenCache = new UserAccessTokenCache($this->tokenRequestContext); // Custom cache
// Create the default handler stack
$handlerStack = GraphClientFactory::getDefaultHandlerStack();
// Add the log handler
$handlerStack->push(Middleware::log(
$this->logger,
new \GuzzleHttp\MessageFormatter('{req_headers} - {req_body} - {res_headers} - {res_body}')
));
$adapter = new GraphRequestAdapter(
GraphPhpLeagueAuthenticationProvider::createWithAccessTokenProvider(
GraphPhpLeagueAccessTokenProvider::createWithCache(
$tokenCache,
$this->tokenRequestContext,
self::AZURE_SCOPES
)
),
GraphClientFactory::createWithMiddleware($handlerStack)
);
$this->graphServiceClient = GraphServiceClient::createWithRequestAdapter($adapter);
Any help with this would be very handy.
The text was updated successfully, but these errors were encountered:
I can't find any practical examples of how to apply logging to graph requests. When things don't work as expected it's really handy to be able to see what you are actually sending and receiving from the API.
I've tried the following but it crashes trying to create the client:
Any help with this would be very handy.
The text was updated successfully, but these errors were encountered: