Skip to content

Commit

Permalink
feat: add .auth/complete rule
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko committed Jun 26, 2020
1 parent 53e2ea7 commit 4bb150c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app_auth_complete/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
],
"route": "app/.auth/complete"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}
33 changes: 33 additions & 0 deletions app_auth_complete/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { response } = require("../utils");

module.exports = async function (context, req) {
const { provider } = context.bindingData;
const { post_login_redirect_uri } = req.query;

const location = `http://localhost:4200/profile`;
context.res = response({
context,
status: 302,
cookies: [
{
name: "StaticWebAppsAuthContextCookie",
value: "deleted",
path: "/",
domain: "localhost",
expires: new Date("Thu, 01 Jan 1970 00:00:00 GMT"),
},
{
name: "StaticWebAppsAuthCookie",
value: "xxx",
path: "/",
secure: true,
HttpOnly: true,
domain: "localhost",
SameSite: "Strict",
},
],
headers: {
location,
},
});
};

0 comments on commit 4bb150c

Please sign in to comment.