Skip to content

Instantly share code, notes, and snippets.

Andrew Connell andrewconnell

Block or report user

Report or block andrewconnell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andrewconnell / teams-manifest.json
Created Apr 24, 2019
Microsoft Teams Manifest file
View teams-manifest.json
"$schema": "",
"manifestVersion": "1.2",
"packageName": "{{SPFX_COMPONENT_ALIAS}}",
"id": "aa3fecf0-1fd0-4751-aba1-12314dc3a22f",
"version": "0.1",
"developer": {
"name": "Parker Porcupine",
"websiteUrl": "",
"privacyUrl": "",
andrewconnell / jest.config.json
Created Apr 15, 2019
Jest v24.* configuration with code coverage for SPFx projects
View jest.config.json
"collectCoverage": true,
"collectCoverageFrom": [
"coverageDirectory": "<rootDir>/../temp/test",
"coverageReporters": [
npm install @microsoft/rush-stack-compiler-3.3@0.1.6 typescript@3.3 --save-dev --exact
View post-spfx1.8.0-webpart.ts
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import {
} from '@microsoft/sp-property-pane';
View pre-spfx1.8.0-webpart.ts
import {
} from '@microsoft/sp-webpart-base';
andrewconnell / decode-jwt-token.ts
Created Feb 18, 2019
Decode JTW token with TypeScript
View decode-jwt-token.ts
import jwt = require('jsonwebtoken');
const decodedValidToken = (accessToken: string) => {
const key: string = '-----BEGIN CERTIFICATE-----\nMIIDBTCCAe...\n-----END CERTIFICATE-----';
// decode & verify token
return jwt.verify(accessToken, key);
const authorizationHeader: string = req.headers.authorization;
andrewconnell / secure-rest-api.ts
Created Feb 18, 2019
Secure REST API (in Azure Function App) Using Permissions
View secure-rest-api.ts
if (isValidRequest) {
switch (req.method) {
case 'GET':
if (hasMissionReadScope) {
response = missionId ? getOne(missionId) : getMany();
} else {
response = {
status: HttpStatusCode.Unauthorized,
body: {
message: 'Insufficient permissions to retrieve missions. Missing scope Mission.Read.'
andrewconnell / secure-rest-api.ts
Last active Feb 18, 2019
Secure REST API - Detect permissions & user making the call
View secure-rest-api.ts
import jwt = require('jsonwebtoken');
const aadKey: string = // aad public key used to sign oauth access token
try {
const authorizationHeader: string = req.headers.authorization;
// decode the token using the AzureAD public signing key
const decodedToken = (jwt.verify(authorizationHeader.replace('Bearer ','')) as any), aadKey);
# start the Office 365 CLI
# >>> make sure you are logged in
# just enough to connect to the endpoint, but not do anything
spo serviceprincipal grant add --resource "voitanos-secure" --scope "user_impersonation"
# get one or many Apollo Missions (HTTP GET)
spo serviceprincipal grant add --resource "voitanos-secure" --scope "Mission.Read"
You can’t perform that action at this time.