michielvdvelde / eve-sso Goto Github PK
View Code? Open in Web Editor NEWEve Online Single Sign On (SSO)
Home Page: https://github.com/MichielvdVelde/eve-sso
License: MIT License
Eve Online Single Sign On (SSO)
Home Page: https://github.com/MichielvdVelde/eve-sso
License: MIT License
Include verification of the token as default part of the module.
Hey,
Thanks for creating this package. Im not sure if this is an issue with the package or with my setup. This error happens after authorising a character, when eve-online sso uses the callback:
TypeError: form_urlencoded_1.default is not a function at SingleSignOn.getAccessToken (/path/to/node_modules/eve-sso/dist/index.js:65:87) at ESI.register (/path/to/node_modules/eve-esi-client/dist/index.js:23:41)
What makes me think this is a package issue is that I've both tried typescript and javascript implementations and they yeild the same result.
I am just trying to run the default code you have written:
index.ts
import ESI from 'eve-esi-client'
import MemoryProvider from 'eve-esi-client/dist/providers/memory.js'
import Koa from 'koa'
import Router from 'koa-router'
import { client_id, secret} from "./secret.js";
const PORT = 8002;
const provider = new MemoryProvider();
const esi = new ESI({
provider,
clientId: client_id,
secretKey: secret,
callbackUri: 'https://www.<redacted>.com/callback'
})
const app = new Koa()
const router = new Router()
router.get('/login', async ctx => {
const redirectUrl = esi.getRedirectUrl('some-state', 'esi-skills.read_skills.v1')
ctx.body = `<a href="${redirectUrl}">Log in using Eve Online</a>`
})
router.get('/callback', async ctx => {
const code: string = ctx.query.code.toString()
const { character } = await esi.register(code)
ctx.res.statusCode = 302
ctx.res.setHeader('Location', `/welcome/${character.characterId}`)
})
app.use(router.middleware())
app.listen(PORT, function() {
console.log(`Server listening on port ${PORT}`)
})
package.json
{
"name": "redacted",
"version": "1.0.0",
"description": "",
"main": "./dist/index.js",
"scripts": {
"start": "npx tsc --p tsconfig.json && nodemon ./dist/index.js ",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "redacted"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "redacted"
},
"homepage": "redacted",
"dependencies": {
"eve-esi-client": "^0.6.1",
"eve-sso": "^1.3.0",
"koa": "^2.13.1",
"koa-router": "^10.0.0",
"nodemon": "^2.0.7",
"typescript": "^4.3.2"
},
"devDependencies": {
"@types/koa": "^2.13.3",
"@types/koa-router": "^7.4.2",
"ts-node": "^10.0.0"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"module": "commonjs",
"moduleResolution": "node",
"removeComments": true,
"preserveConstEnums": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"noImplicitAny": true,
"declaration": true,
"outDir": "./dist"
},
"include": [
"./src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.