fix the bug "require approval" (#9859)

## The bug : 
"Approval required" even though admin consent has been granted for the
whole tenant"

Fix https://github.com/twentyhq/core-team-issues/issues/277 

### More details
described here in
[stackoverflow](https://stackoverflow.com/questions/79385342/approval-required-even-though-admin-consent-has-been-granted-for-the-whole-ten?noredirect=1#comment140006092_79385342)
This commit is contained in:
Guillim
2025-01-27 14:36:01 +01:00
committed by GitHub
parent c1e84a746c
commit 77c586db24
3 changed files with 8 additions and 3 deletions

View File

@ -77,7 +77,6 @@ export class MicrosoftAPIsAuthController {
AuthExceptionCode.FORBIDDEN_EXCEPTION,
);
}
if (!workspaceId) {
throw new AuthException(
'Workspace not found',
@ -85,6 +84,12 @@ export class MicrosoftAPIsAuthController {
);
}
if (emails.length === 0) {
throw new AuthException(
'No email - Ask your Azure Entra Admin to add you one on top of your User Principal Name',
AuthExceptionCode.USER_NOT_FOUND,
);
}
const handle = emails[0].value;
await this.microsoftAPIsService.refreshMicrosoftRefreshToken({

View File

@ -21,7 +21,7 @@ export class GoogleAPIsOauthRequestCodeStrategy extends GoogleAPIsOauthCommonStr
options = {
...options,
accessType: 'offline',
prompt: 'consent',
prompt: 'select_account',
loginHint: req.params.loginHint,
state: JSON.stringify({
transientToken: req.params.transientToken,

View File

@ -13,7 +13,7 @@ export class MicrosoftAPIsOauthRequestCodeStrategy extends MicrosoftAPIsOauthCom
options = {
...options,
accessType: 'offline',
prompt: 'consent',
prompt: 'select_account',
loginHint: req.params.loginHint,
state: JSON.stringify({
transientToken: req.params.transientToken,