This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets an access token for the user using the on-behalf-of flow | |
* @param authHeader - The Authorization header value containing a JWT bearer token | |
* @returns {Promise<string | null>} - Returns the access token if successful, null if not | |
*/ | |
export async function getAccessTokenOnBehalfOf(req: Request, res: Response): Promise<void> { | |
// The token has already been validated, just grab it and the other values from the query string | |
const ssoToken: string = req.headers.authorization!.split(' ')[1]; | |
const clientId: string = req.body.clientId!.toString(); | |
const graphScopes: string[] = req.body.scopes!.toString().split(','); |