Skip to content

Instantly share code, notes, and snippets.

Phil Harding phillipharding

Block or report user

Report or block phillipharding

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
View AzureAD v1.0 Authorisation Code Grant
POST /{tenant id}/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
client_id:{client id}
client_secret:{client secret}
grant_type:authorization_code
code:{authorisation code}
redirect_uri:{redirect_uri}
View AzureAD v1.0 Refresh Token Grant
POST /{tenant id}/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
client_id:{client id}
client_secret:{client secret}
grant_type:refresh_token
refresh_token:{refresh_token_value}
resource:https://graph.microsoft.com/
View AzureAD v1.0 Resource Owner Password Credentials Grant
POST /{tenant id}/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
client_id:{client id}
client_secret:{client secret}
grant_type:password
resource:https://graph.microsoft.com/
username:{user upn}
View AzureAD v1.0 Client Credentials Grant
POST /tenant id/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
client_id:the client id
client_secret:the client secret
grant_type:client_credentials
resource:https://graph.microsoft.com/
@phillipharding
phillipharding / AppOnlyCertificateGenerationWithOpenSSL.sh
Created Mar 8, 2019
Generates a certificate to use in app-only authentication scenarios with Office 365 Azure AD
View AppOnlyCertificateGenerationWithOpenSSL.sh
#!/bin/bash
set -euo pipefail
CERTFILE=certificate.cer
PRIVATEKEYFILE=private-key.pem
DAYS=1095
echo "
Generated certificate will have an expiry of $DAYS days [$((DAYS / 365)) years] from today.
"
openssl req -x509 -newkey rsa:2048 -sha1 -keyout $PRIVATEKEYFILE -out $CERTFILE -nodes -set_serial 1 -days $DAYS -config cert-config.cnf
View Chrome Snippets MBP13.json
[
{
"id": "2",
"name": "Print Display ListForm using Dialog",
"content": "function onListFormPrintViewDialogClosed(dialogResult, returnValue) {\n console.log(\"Print View Dialog closed, result: \" + dialogResult);\n}\n\nfunction showListFormPrintViewDialog(e) {\n e.preventDefault();\n var formUrl = e.data && e.data.url && e.data.url.length ? e.data.url : '';\n if (e.data && (!e.data.url && !e.data.url.length)) {\n /* no url supplied, get the DispForm url for the current listitem form */\n var formCtxName = ($(\"*[id$='ClientFormPlaceholder']\")\n .attr('id')\n .replace(/ClientFormPlaceholder/gi,'')) || \"\";\n var formCtx = window[formCtxName+\"FormCtx\"];\n var listItemId = formCtx && formCtx.ItemAttributes\n ? formCtx.ItemAttributes.Id \n : 0;\n formUrl = formCtx.RedirectInfo\n ? formCtx.RedirectInfo.listRootFolderUrl + \"/DispForm.aspx?ID=\" + listItemId\n
View Summary Links.webpart
View Calendar ListView Webpart Definition.xml
<AllUsersWebPart WebPartZoneID="Footer" WebPartOrder="1" ListTitle="Calendar">
<!-- Calendar Webpart -->
<Query>
<Where>
<And>
<DateRangesOverlap>
<FieldRef Name="EventDate"/>
<FieldRef Name="EndDate"/>
<FieldRef Name="RecurrenceID"/>
<Value Type="DateTime">
@phillipharding
phillipharding / implicitflow_usage.js
Created Jun 20, 2017 — forked from paulryan/implicitflow_usage.js
Usage of OAuth implict flow lib
View implicitflow_usage.js
var aadAppClientId = "8BE5AA0E-F900-4BDF-A7CF-71B3CC53B78E";
var resource = "https://graph.microsoft.com"
var query = "/v1.0/me/events";
var tokenFactory = new CC.CORE.Adal.AppTokenFactory(aadAppClientId, resource);
tokenFactory.ExecuteQuery(query)
.done(function (response) {
// Success!
})
.fail(function (response) {
// NOTE: Provide a link to renew an expired or yet to be approved session:
@phillipharding
phillipharding / adal_lib.js
Created Jun 20, 2017 — forked from paulryan/adal_lib.js
Custom "adal" implementation for OAuth implict flow
View adal_lib.js
var CC = CC || {};
CC.CORE = CC.CORE || {};
CC.CORE.Log = function (errMsg) {
// console.log is undefined in IE10 and earlier unless in debug mode, so must check for it
if (typeof window.console === "object" && typeof console.log === "function") {
console.log(errMsg);
}
};
You can’t perform that action at this time.