I want to access url parameters in Azure AD callback in […nextauth] callbacks
This is my login form
const handleAzureSignIn = () => {
signIn('azure-ad', { callbackUrl: `${window.location.origin}/api/auth/callback/azure-ad?tenantId=${tenantId}` });
};
Here I have passed the tenentId with the callback URL. Then I want to access from the tenentId in the […nextauth] after the authentication
callbacks: {
async signIn({ user, account, profile }) {
if (account.provider === 'azure-ad') {
//need to access the parameter here
if (user) {
return { ...azureUser, ...userRes }; //userRes;
} else {
return null;
}
} catch (e) {
return false;
}
}
// For other providers, return true to continue the sign in process.
return true;
},