diff --git a/socios-oauth2/app.js b/socios-oauth2/app.js index 4d64194d4..3fab41dfd 100644 --- a/socios-oauth2/app.js +++ b/socios-oauth2/app.js @@ -1,6 +1,6 @@ import path from "path"; import express from "express"; -import { Server } from "./../token-negotiator-server/dist/index.js"; +import { Server } from "@tokenscript/token-negotiator-server"; import { fileURLToPath } from 'url'; import bodyParser from "body-parser"; import cookieParser from "cookie-parser"; @@ -32,8 +32,7 @@ const tokenNegotiatorServer = new Server({ } }); -// Same origin Cors -const corsOptions = { origin: 'http://localhost.5000' } +const corsOptions = { origin: process.env.APPLICATION_URL } app.get("/", function (request, response) { response.sendFile(path.join(__dirname, "./public/index.html")); diff --git a/socios-oauth2/package-lock.json b/socios-oauth2/package-lock.json index 247c7c5c4..3bbc23051 100644 --- a/socios-oauth2/package-lock.json +++ b/socios-oauth2/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@tokenscript/token-negotiator": "^3.0.0", + "@tokenscript/token-negotiator-server": "^0.1.0", "body-parser": "^1.20.2", "cookie-parser": "^1.4.6", "cors": "^2.8.5", @@ -2693,6 +2694,19 @@ "web3-eth-accounts": "^1.7.4" } }, + "node_modules/@tokenscript/token-negotiator-server": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator-server/-/token-negotiator-server-0.1.0.tgz", + "integrity": "sha512-FAMCzxaDj9HFPh619x2RnSVCEWaRH+5zpfN0dZ0QxkXhFgAtPZ7T2OXuCoivnnsFIu4ZqwTP0/otZ+cCJMq+zA==", + "dependencies": { + "dotenv": "^16.3.1", + "node-fetch": "^3.3.2", + "pako": "^2.1.0", + "stream": "^0.0.2", + "typescript": "^5.1.6", + "zlib": "^1.0.5" + } + }, "node_modules/@toruslabs/http-helpers": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-4.0.0.tgz", @@ -4561,6 +4575,11 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, + "node_modules/emitter-component": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.1.tgz", + "integrity": "sha512-G+mpdiAySMuB7kesVRLuyvYRqDmshB7ReKEVuyBPkzQlmiDiLrt7hHHIy4Aff552bgknVN7B2/d3lzhGO5dvpQ==" + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -8999,6 +9018,14 @@ "node": ">= 0.8" } }, + "node_modules/stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", + "integrity": "sha512-gCq3NDI2P35B2n6t76YJuOp7d6cN/C7Rt0577l91wllh0sY9ZBuw9KaSGqH/b0hzn3CWWJbpbW0W0WvQ1H/Q7g==", + "dependencies": { + "emitter-component": "^1.1.1" + } + }, "node_modules/stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -9514,7 +9541,6 @@ "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10260,6 +10286,15 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zlib": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz", + "integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==", + "hasInstallScript": true, + "engines": { + "node": ">=0.2.0" + } } }, "dependencies": { @@ -12336,6 +12371,19 @@ "web3-eth-accounts": "^1.7.4" } }, + "@tokenscript/token-negotiator-server": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@tokenscript/token-negotiator-server/-/token-negotiator-server-0.1.0.tgz", + "integrity": "sha512-FAMCzxaDj9HFPh619x2RnSVCEWaRH+5zpfN0dZ0QxkXhFgAtPZ7T2OXuCoivnnsFIu4ZqwTP0/otZ+cCJMq+zA==", + "requires": { + "dotenv": "^16.3.1", + "node-fetch": "^3.3.2", + "pako": "^2.1.0", + "stream": "^0.0.2", + "typescript": "^5.1.6", + "zlib": "^1.0.5" + } + }, "@toruslabs/http-helpers": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-4.0.0.tgz", @@ -13861,6 +13909,11 @@ } } }, + "emitter-component": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.1.tgz", + "integrity": "sha512-G+mpdiAySMuB7kesVRLuyvYRqDmshB7ReKEVuyBPkzQlmiDiLrt7hHHIy4Aff552bgknVN7B2/d3lzhGO5dvpQ==" + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -17147,6 +17200,14 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" }, + "stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", + "integrity": "sha512-gCq3NDI2P35B2n6t76YJuOp7d6cN/C7Rt0577l91wllh0sY9ZBuw9KaSGqH/b0hzn3CWWJbpbW0W0WvQ1H/Q7g==", + "requires": { + "emitter-component": "^1.1.1" + } + }, "stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -17536,8 +17597,7 @@ "typescript": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "peer": true + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==" }, "typical": { "version": "4.0.0", @@ -18138,6 +18198,11 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + }, + "zlib": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz", + "integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==" } } } diff --git a/socios-oauth2/package.json b/socios-oauth2/package.json index af8fd902c..94b534829 100644 --- a/socios-oauth2/package.json +++ b/socios-oauth2/package.json @@ -14,6 +14,7 @@ "license": "ISC", "dependencies": { "@tokenscript/token-negotiator": "^3.0.0", + "@tokenscript/token-negotiator-server": "^0.1.0", "body-parser": "^1.20.2", "cookie-parser": "^1.4.6", "cors": "^2.8.5", diff --git a/socios-oauth2/public/socios-client-config.js b/socios-oauth2/public/socios-client-config.js index c01dfaa4f..659d709fe 100644 --- a/socios-oauth2/public/socios-client-config.js +++ b/socios-oauth2/public/socios-client-config.js @@ -17,14 +17,6 @@ const sociosClientConfig = () => { path: "http://localhost:5000/user-login-callback", params: {} }, - userLogout: { - path: "http://localhost:5000/user-logout", - params: {} - }, - userSignature: { - path: 'http://localhost:5000/user-signature', - params: {} - }, userBalance: { path: 'http://localhost:5000/user-balance', params: {}