-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling refresh of auth token #9
Labels
backend
Related to backend/apis
Complexity: large
Issue/PR with large complexity
enhancement
New feature or request
help wanted
Extra attention is needed
Priority: high
Issue with high priority
Milestone
Comments
Closed
olemp
added
enhancement
New feature or request
help wanted
Extra attention is needed
Priority: high
Issue with high priority
Complexity: large
Issue/PR with large complexity
and removed
bug
Something isn't working
labels
Feb 6, 2020
So the const path = require('path');
const graphql = require('express-graphql');
const { importSchema } = require('graphql-import');
const { makeExecutableSchema } = require('graphql-tools');
const StorageService = require('../../services/storage');
const GraphService = require('../../services/graph');
const schema = makeExecutableSchema({
typeDefs: importSchema(path.join(__dirname, './schema.graphql')),
resolvers: require('./resolvers'),
resolverValidationOptions: {
requireResolversForResolveType: false
},
});
module.exports = graphql((req) => ({
schema: schema,
rootValue: global,
graphiql: process.env.GRAPHIQL_ENABLED == '1',
pretty: req.app.get('env') === 'development',
context: {
services: {
graph: new GraphService(req.user.oauthToken),
storage: new StorageService(req.user.profile._json.tid),
},
user: req.user,
tid: req.user.profile._json.tid,
}
})); In the GraphService.prototype.getEvents = async function (startDateTime, endDateTime) {
log('Querying Graph /me/calendar/calendarView: %s', JSON.stringify({ startDateTime, endDateTime }));
const { value } = await this.getClient()
.api('/me/calendar/calendarView')
.query({ startDateTime, endDateTime })
.select('id,subject,body,start,end,lastModifiedDateTime,categories,webLink,isOrganizer')
.filter(`sensitivity ne 'private' and isallday eq false and iscancelled eq false`)
.orderby('start/dateTime asc')
.top(50)
.get();
log('Retrieved %s events from /me/calendar/calendarView', value.length);
let events = value
.filter(evt => evt.subject)
.map(evt => ({
id: evt.id,
title: evt.subject,
body: stripHtml(evt.body.content),
isOrganizer: evt.isOrganizer,
categories: evt.categories,
webLink: evt.webLink,
lastModifiedDateTime: new Date(evt.lastModifiedDateTime).toISOString(),
startTime: new Date(evt.start.dateTime).toISOString(),
endTime: new Date(evt.end.dateTime).toISOString(),
durationHours: utils.getDurationHours(evt.start.dateTime, evt.end.dateTime),
durationMinutes: utils.getDurationMinutes(evt.start.dateTime, evt.end.dateTime),
}));
events = this.removeIgnoredEvents(events);
return events;
}; |
In fiznool/passport-oauth2-refresh#1 user.save({ accessToken: accessToken }, function() {
makeRequest();
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend
Related to backend/apis
Complexity: large
Issue/PR with large complexity
enhancement
New feature or request
help wanted
Extra attention is needed
Priority: high
Issue with high priority
bitbucket.org/puzzlepart/pzl-did365/branch/feature/oauth2-refresh
The text was updated successfully, but these errors were encountered: