From c0312f1ed0745d8b25bae1ff3603648efae1dc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Paw=C5=82aszek?= Date: Mon, 27 Nov 2023 11:07:45 +0100 Subject: [PATCH] feat: making MS Sharepoint Online refresh token optional --- src/microsoftdynamics365/profile.ts | 1 + src/microsoftsharepointonline/profile.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/microsoftdynamics365/profile.ts b/src/microsoftdynamics365/profile.ts index 08210743..ae920a16 100644 --- a/src/microsoftdynamics365/profile.ts +++ b/src/microsoftdynamics365/profile.ts @@ -95,6 +95,7 @@ export class MicrosoftDynamics365ConnectorProfile extends ConnectorProfileBase { oauth2: { // INFO: when using Refresh Token Grant Flow - access token property is required accessToken: properties.oAuth.accessToken?.unsafeUnwrap() ?? 'dummyAccessToken', + // INFO: when passing only an access token - this value is still required refreshToken: properties.oAuth.flow?.refreshTokenGrant.refreshToken?.unsafeUnwrap() ?? 'dummyRefreshToken', clientId: properties.oAuth.flow?.refreshTokenGrant.clientId?.unsafeUnwrap(), clientSecret: properties.oAuth.flow?.refreshTokenGrant.clientSecret?.unsafeUnwrap(), diff --git a/src/microsoftsharepointonline/profile.ts b/src/microsoftsharepointonline/profile.ts index 0dd3260d..1f5871d4 100644 --- a/src/microsoftsharepointonline/profile.ts +++ b/src/microsoftsharepointonline/profile.ts @@ -91,7 +91,8 @@ export class MicrosoftSharepointOnlineConnectorProfile extends ConnectorProfileB oauth2: { // INFO: when using Refresh Token Grant Flow - access token property is required accessToken: properties.oAuth.accessToken?.unsafeUnwrap() ?? 'dummyAccessToken', - refreshToken: properties.oAuth.flow?.refreshTokenGrant.refreshToken?.unsafeUnwrap(), + // INFO: when passing only an access token - this value is still required + refreshToken: properties.oAuth.flow?.refreshTokenGrant.refreshToken?.unsafeUnwrap() ?? 'dummyRefreshToken', clientId: properties.oAuth.flow?.refreshTokenGrant.clientId?.unsafeUnwrap(), clientSecret: properties.oAuth.flow?.refreshTokenGrant.clientSecret?.unsafeUnwrap(), },