I am trying to create an application where i want to fetch Outlook mails. I am using using simple OAuth 2.0 for the access token. I am successfully getting the code. When I am trying to get the access token in exchange of code I am getting 400 bad request error.
const tokenConfig = {
code: auth_code,
redirect_uri: redirectUri,
scope: scopes.join(' ')
};
try {
const result = await oauth2.authorizationCode.getToken(tokenConfig);
const accessToken = oauth2.accessToken.create(result);
} catch (error) {
console.log('Access Token Error', error.message);
}
Can you help what wrong I am doing. Please comment for more information.