forked from authts/oidc-client-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
101 additions
and
76 deletions.
There are no files selected for viewing
15 changes: 2 additions & 13 deletions
15
samples/Parcel/src/code-flow-identityserver/sample-callback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
Log.logger = console; | ||
Log.level = Log.DEBUG; | ||
|
||
function log() { | ||
document.getElementById("out").innerText = ""; | ||
|
||
Array.prototype.forEach.call(arguments, function(msg) { | ||
if (msg instanceof Error) { | ||
msg = "Error: " + msg.message; | ||
} | ||
else if (typeof msg !== "string") { | ||
msg = JSON.stringify(msg, null, 2); | ||
} | ||
document.getElementById("out").innerHTML += msg + "\r\n"; | ||
}); | ||
} | ||
new UserManager(settings).signinCallback().then(function(user) { | ||
log("signin response success", user); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
17 changes: 6 additions & 11 deletions
17
samples/Parcel/src/code-flow-identityserver/sample-popup-signin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
|
||
var log = { | ||
debug:logMessage, warn: logMessage, info: logMessage, error:logMessage | ||
}; | ||
|
||
function logMessage(msg) { | ||
document.getElementById("logMessages").innerHTML += "<li>" + msg + "</li>"; | ||
console.log(msg); | ||
} | ||
import { log } from "./sample"; | ||
|
||
Log.logger = console; // log; | ||
Log.level = Log.DEBUG; | ||
|
||
new UserManager(settings).signinCallback().catch(function(err) { | ||
Log.logger.error("error: " + err && err.message); | ||
new UserManager(settings).signinCallback().then(function(user) { | ||
log("signin response success", user); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
21 changes: 7 additions & 14 deletions
21
samples/Parcel/src/code-flow-identityserver/sample-popup-signout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
function log() { | ||
document.getElementById("out").innerText = ""; | ||
|
||
Array.prototype.forEach.call(arguments, function(msg) { | ||
if (msg instanceof Error) { | ||
msg = "Error: " + msg.message; | ||
} | ||
else if (typeof msg !== "string") { | ||
msg = JSON.stringify(msg, null, 2); | ||
} | ||
document.getElementById("out").innerHTML += msg + "\r\n"; | ||
}); | ||
} | ||
// can pass true param and will keep popup window open | ||
new UserManager(settings).signoutCallback(); | ||
new UserManager(settings).signoutCallback().then(function() { | ||
log("signout callback response success"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
21 changes: 7 additions & 14 deletions
21
samples/Parcel/src/code-flow-identityserver/sample-silent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
function log() { | ||
document.getElementById("out").innerText = ""; | ||
|
||
Array.prototype.forEach.call(arguments, function(msg) { | ||
if (msg instanceof Error) { | ||
msg = "Error: " + msg.message; | ||
} | ||
else if (typeof msg !== "string") { | ||
msg = JSON.stringify(msg, null, 2); | ||
} | ||
document.getElementById("out").innerHTML += msg + "\r\n"; | ||
}); | ||
} | ||
void new UserManager(settings).signinCallback(); | ||
new UserManager(settings).signinCallback().then(function(user) { | ||
log("signin callback response success", user); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { Log, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
function log() { | ||
document.getElementById("out").innerText = ""; | ||
|
||
Array.prototype.forEach.call(arguments, function(msg) { | ||
if (msg instanceof Error) { | ||
msg = "Error: " + msg.message; | ||
} | ||
else if (typeof msg !== "string") { | ||
msg = JSON.stringify(msg, null, 2); | ||
} | ||
document.getElementById("out").innerHTML += msg + "\r\n"; | ||
}); | ||
} | ||
new OidcClient(settings).processSigninResponse().then(function(response) { | ||
log("signin response success", response); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
new UserManager(settings).signinRedirectCallback().then(function(user) { | ||
console.log("signin response success", user); | ||
}).catch(function(err) { | ||
log(err); | ||
console.log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
import { UserManager, settings } from "./sample-settings"; | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
void new UserManager(settings).signinPopupCallback(); | ||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
new UserManager(settings).signinPopupCallback().then(function() { | ||
log("signin popup callback response success"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
import { UserManager, settings } from "./sample-settings"; | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
void new UserManager(settings).signoutPopupCallback(undefined, true); | ||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
new UserManager(settings).signoutPopupCallback(undefined, true).then(function() { | ||
log("signout popup callback response success"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
import { UserManager, settings } from "./sample-settings"; | ||
import { Log, UserManager, settings } from "./sample-settings"; | ||
import { log } from "./sample"; | ||
|
||
void new UserManager(settings).signinSilentCallback(); | ||
Log.logger = console; | ||
Log.level = Log.INFO; | ||
|
||
new UserManager(settings).signinSilentCallback().then(function() { | ||
log("signin silent callback response success"); | ||
}).catch(function(err) { | ||
console.error(err); | ||
log(err); | ||
}); |
Oops, something went wrong.