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:
@ -77,7 +77,6 @@ export class MicrosoftAPIsAuthController {
|
|||||||
AuthExceptionCode.FORBIDDEN_EXCEPTION,
|
AuthExceptionCode.FORBIDDEN_EXCEPTION,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
throw new AuthException(
|
throw new AuthException(
|
||||||
'Workspace not found',
|
'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;
|
const handle = emails[0].value;
|
||||||
|
|
||||||
await this.microsoftAPIsService.refreshMicrosoftRefreshToken({
|
await this.microsoftAPIsService.refreshMicrosoftRefreshToken({
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export class GoogleAPIsOauthRequestCodeStrategy extends GoogleAPIsOauthCommonStr
|
|||||||
options = {
|
options = {
|
||||||
...options,
|
...options,
|
||||||
accessType: 'offline',
|
accessType: 'offline',
|
||||||
prompt: 'consent',
|
prompt: 'select_account',
|
||||||
loginHint: req.params.loginHint,
|
loginHint: req.params.loginHint,
|
||||||
state: JSON.stringify({
|
state: JSON.stringify({
|
||||||
transientToken: req.params.transientToken,
|
transientToken: req.params.transientToken,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export class MicrosoftAPIsOauthRequestCodeStrategy extends MicrosoftAPIsOauthCom
|
|||||||
options = {
|
options = {
|
||||||
...options,
|
...options,
|
||||||
accessType: 'offline',
|
accessType: 'offline',
|
||||||
prompt: 'consent',
|
prompt: 'select_account',
|
||||||
loginHint: req.params.loginHint,
|
loginHint: req.params.loginHint,
|
||||||
state: JSON.stringify({
|
state: JSON.stringify({
|
||||||
transientToken: req.params.transientToken,
|
transientToken: req.params.transientToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user