Open waldekmastykarz opened 9 months ago
Currently, getting started instructions are missing the steps to configure the auth provider. We're referencing our live documentation, which unfortunately isn't working, because it's incompatible with this SDK. To help developers try this SDK, we should include a fully working sample, for example:
import { ClientSecretCredential } from '@azure/identity'; import { AzureIdentityAuthenticationProvider } from '@microsoft/kiota-authentication-azure'; import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary"; import { createGraphServiceClient } from "@microsoft/msgraph-sdk"; import "@microsoft/msgraph-sdk-users"; import 'dotenv/config'; (async () => { const credential = new ClientSecretCredential( process.env.TENANT_ID, process.env.CLIENT_ID, process.env.CLIENT_SECRET ); const authProvider = new AzureIdentityAuthenticationProvider(credential, ['https://graph.microsoft.com/.default']); const requestAdapter = new FetchRequestAdapter(authProvider); const graphServiceClient = createGraphServiceClient(requestAdapter); try { const users = await graphServiceClient.users.get(); console.log(JSON.stringify(users)); } catch (error) { console.error(error); } })();
Hello, but even when I copy paste your version I'm getting:
TypeError: requestAdapter.send is not a function
any suggestions?
@drloloto can you report which versions of the kiota dependencies are installed in your project please? It looks like you might be using older versions.
@baywet Thanks you were right! Have a nice day 👍
i tried using this example but got an error in runtime : /Users/eyal/.nvm/versions/node/v20.13.1/bin/node ./dist/apps/integrator/src/entra-index.js Uncaught SyntaxError /Users/eyal/Projects/integrations-new/integrations/node_modules/@microsoft/kiota-authentication-azure/dist/es/src/index.js:7 export * from "./azureIdentityAuthenticationProvider"; ^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader:1281:20)
at Module._compile (internal/modules/cjs/loader:1321:27)
at Module._extensions..js (internal/modules/cjs/loader:1416:10)
at Module.load (internal/modules/cjs/loader:1208:32)
at Module._load (internal/modules/cjs/loader:1024:12)
at Module.require (internal/modules/cjs/loader:1233:19)
at require (internal/modules/helpers:179:18)
at
any idea why ? i am using : "@microsoft/kiota-authentication-azure": "^1.0.0-preview.48" (from package.json)
@eyal-ringwald-orchid this is getting addressed with that PR https://github.com/microsoft/kiota-typescript/pull/1225 Can you try to upgrade your kiota dependencies to the latest version (today) and see if you still run into the issue? (we might need to roll out new version of graph core and this library here)
now the new api has changed so there is no such thing as graphServiceClient.user , so i am leaving this try aside.
@eyal-ringwald-orchid did you install and import the @microsoft/msgraph-sdk-users
package?
Also it should be users (plural)
Currently, getting started instructions are missing the steps to configure the auth provider. We're referencing our live documentation, which unfortunately isn't working, because it's incompatible with this SDK. To help developers try this SDK, we should include a fully working sample, for example: