File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
import MicrosoftEntraID from '@auth/core/providers/microsoft-entra-id' ;
2
- import { getUserDetails } from '@/services/msGraphApi ' ;
2
+ import { getUserDetails } from '@/services/msGraph ' ;
3
3
import type { NextAuthConfig } from 'next-auth' ;
4
4
5
5
export const authConfig = {
Original file line number Diff line number Diff line change 2
2
3
3
import { Client } from '@microsoft/microsoft-graph-client' ;
4
4
5
- export async function getUserDetails ( accessToken : string ) {
6
- // https://learn.microsoft.com/en-us/graph/sdks/create-client?tabs=typescript
7
- const client = Client . init ( {
5
+ const initializeGraphClient = ( accessToken : string ) => {
6
+ return Client . init ( {
8
7
authProvider : ( done ) => done ( null , accessToken ) ,
9
8
} ) ;
9
+ } ;
10
+
11
+ export async function getUserDetails ( accessToken : string ) {
12
+ const client = initializeGraphClient ( accessToken ) ;
10
13
const userDetails = await client . api ( '/me' ) . get ( ) ;
11
14
return userDetails ;
12
15
}
You can’t perform that action at this time.
0 commit comments