Added User.Read explicitly to office 365 oauth scopes, as it seems some setups do not automatically apply this scope.
This commit is contained in:
parent
8010abf15a
commit
6a9632bb12
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ const o365Auth = (credential) => {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
'scope': 'Calendars.Read Calendars.ReadWrite',
|
'scope': 'User.Read Calendars.Read Calendars.ReadWrite',
|
||||||
'client_id': process.env.MS_GRAPH_CLIENT_ID,
|
'client_id': process.env.MS_GRAPH_CLIENT_ID,
|
||||||
'refresh_token': refreshToken,
|
'refresh_token': refreshToken,
|
||||||
'grant_type': 'refresh_token',
|
'grant_type': 'refresh_token',
|
||||||
|
@ -200,4 +200,4 @@ const getBusyTimes = (withCredentials, dateFrom, dateTo) => Promise.all(
|
||||||
|
|
||||||
const createEvent = (credential, evt: CalendarEvent) => calendars([ credential ])[0].createEvent(evt);
|
const createEvent = (credential, evt: CalendarEvent) => calendars([ credential ])[0].createEvent(evt);
|
||||||
|
|
||||||
export { getBusyTimes, createEvent, CalendarEvent };
|
export { getBusyTimes, createEvent, CalendarEvent };
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
import { getSession } from 'next-auth/client';
|
import { getSession } from 'next-auth/client';
|
||||||
import prisma from '../../../../lib/prisma';
|
import prisma from '../../../../lib/prisma';
|
||||||
|
|
||||||
const scopes = ['Calendars.Read', 'Calendars.ReadWrite'];
|
const scopes = ['User.Read', 'Calendars.Read', 'Calendars.ReadWrite'];
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
|
|
Loading…
Reference in a new issue