@bananacool467/authtics 1.0.11 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +23 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -60,7 +60,12 @@ exports.authtics = {
60
60
  else {
61
61
  account = yield a.json();
62
62
  }
63
- const carriedInfo = {};
63
+ const carriedInfo = {
64
+ action: null,
65
+ failed: false,
66
+ status: null,
67
+ error: null
68
+ };
64
69
  const login = () => __awaiter(void 0, void 0, void 0, function* () {
65
70
  window.location.href = "/api/authtics-integration/login?r=" + (window.location.pathname + (window.location.search.replace("&", "%26")));
66
71
  });
@@ -76,7 +81,7 @@ exports.authtics = {
76
81
  cookieParser(),
77
82
  (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
78
83
  var _a;
79
- if (req.path != '/api/authtics-integration/get-account') {
84
+ if (req.path != '/api/authtics-integration/get-account' && req.path != '/api/authtics-integration/login' && req.path != '/api/authtics-integration/logout') {
80
85
  const userIp = req.ip;
81
86
  const token = req.query.accessToken;
82
87
  const cookie = (_a = req.cookies) === null || _a === void 0 ? void 0 : _a.AUTHTICS_ACCOUNT_ACCESS_TOKEN;
@@ -108,6 +113,22 @@ exports.authtics = {
108
113
  res.status(200).json({ account, success: true });
109
114
  next();
110
115
  }
116
+ else if (req.path == '/api/authtics-integration/login') {
117
+ const { search } = req.body;
118
+ res.status(200).json({ redirect: ("https://eb29e77b-9bd2-4e3b-9469-81d3af2a8fbe-00-1ag45w1mgbsv1.picard.replit.dev/login?client_id=" + clientId + "&redirect=" + (search.replace("&", "%26"))) });
119
+ next();
120
+ }
121
+ else if (req.path == '/api/authtics-integration/logout') {
122
+ const redirect = req.query.r;
123
+ res.clearCookie('AUTHTICS_ACCOUNT_ACCESS_TOKEN', {
124
+ path: '/',
125
+ secure: true,
126
+ sameSite: 'Lax'
127
+ });
128
+ req.authtics_token = null;
129
+ res.status(200).json({ redirect: redirect });
130
+ next();
131
+ }
111
132
  })
112
133
  ];
113
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics",
3
- "version": "1.0.11",
3
+ "version": "1.0.23",
4
4
  "description": "Use Authtics (An Auth service) to add accounts to your site like Auth0! (This is currently underdevelopment. Issues are expected.)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",