Outlook calendar sync use new app id
This commit is contained in:
parent
74f407edd4
commit
db0c64a60b
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"associatedApplications": [
|
"associatedApplications": [
|
||||||
{
|
{
|
||||||
"applicationId": "78739601-9834-4d41-a281-74ca2a50b2e6"
|
"applicationId": "5d1ab8af-1ba3-4b79-b033-b0ee509c2be6"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,12 @@ import {
|
||||||
|
|
||||||
import outlookLogo from 'res/outlook.svg';
|
import outlookLogo from 'res/outlook.svg';
|
||||||
|
|
||||||
|
const scopes = ['Calendars.Read', 'Calendars.Read.Shared'];
|
||||||
|
|
||||||
// Initialise the MSAL object
|
// Initialise the MSAL object
|
||||||
const publicClientApplication = new PublicClientApplication({
|
const publicClientApplication = new PublicClientApplication({
|
||||||
auth: {
|
auth: {
|
||||||
clientId: '78739601-9834-4d41-a281-74ca2a50b2e6',
|
clientId: '5d1ab8af-1ba3-4b79-b033-b0ee509c2be6',
|
||||||
redirectUri: process.env.NODE_ENV === 'production' ? 'https://crab.fit' : 'http://localhost:3000',
|
redirectUri: process.env.NODE_ENV === 'production' ? 'https://crab.fit' : 'http://localhost:3000',
|
||||||
},
|
},
|
||||||
cache: {
|
cache: {
|
||||||
|
|
@ -61,9 +63,7 @@ const OutlookCalendar = ({ timeZone, timeMin, timeMax, onImport }) => {
|
||||||
|
|
||||||
const signIn = async () => {
|
const signIn = async () => {
|
||||||
try {
|
try {
|
||||||
await publicClientApplication.loginPopup({
|
await publicClientApplication.loginPopup({ scopes });
|
||||||
scopes: ['Calendars.Read', 'Calendars.Read.Shared'],
|
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -90,7 +90,7 @@ const OutlookCalendar = ({ timeZone, timeMin, timeMax, onImport }) => {
|
||||||
|
|
||||||
// Try to get silently
|
// Try to get silently
|
||||||
const result = await publicClientApplication.acquireTokenSilent({
|
const result = await publicClientApplication.acquireTokenSilent({
|
||||||
scopes: ['Calendars.Read', 'Calendars.Read.Shared'],
|
scopes,
|
||||||
account: accounts[0],
|
account: accounts[0],
|
||||||
});
|
});
|
||||||
return result.accessToken;
|
return result.accessToken;
|
||||||
|
|
@ -102,9 +102,7 @@ const OutlookCalendar = ({ timeZone, timeMin, timeMax, onImport }) => {
|
||||||
'no_account_in_silent_request'
|
'no_account_in_silent_request'
|
||||||
].includes(e.message)) {
|
].includes(e.message)) {
|
||||||
// Try to get with popup
|
// Try to get with popup
|
||||||
const result = await publicClientApplication.acquireTokenPopup({
|
const result = await publicClientApplication.acquireTokenPopup({ scopes });
|
||||||
scopes: ['Calendars.Read', 'Calendars.Read.Shared'],
|
|
||||||
});
|
|
||||||
return result.accessToken;
|
return result.accessToken;
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue