michielvdvelde / eve-esi Goto Github PK
View Code? Open in Web Editor NEWClient for Eve Online ESI
Home Page: https://michielvdvelde.github.io/eve-esi/
License: MIT License
Client for Eve Online ESI
Home Page: https://michielvdvelde.github.io/eve-esi/
License: MIT License
Valid status codes are explicitly set to 200, and 201 for non-GET requests, here:
Line 207 in fff168f
However, some ESI endpoints return a status code of 204 upon success (e.g. PUT routes like /characters/{character_id}/calendar/{event_id}/
, every POST route under /ui/
, every DELETE route).
The update()
methods on the provider interfaces may collide with, for example, mongoose documents. These methods should be renamed.
Character.update()
to Character.updateCharacter()
Token.update()
to Token.updateToken()
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"
]
}
The implementation of getToken()
in the memory provider checks if the requested scopes match a token exactly. This is not necessary; a token may have more scopes than requested. Reimplement the method to return the first token that has all requested scopes.
The instance stores reference to a Provider
interface. This interface is designed to be easily extensible. Currently this.provider
returns a vanilla Provider
type.
This type should be extensible so it supports the extended interface.
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.