Code Monkey home page Code Monkey logo

eve-sso's People

Contributors

alfanhui avatar michielvdvelde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eve-sso's Issues

TypeError: form_urlencoded_1.default is not a function

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"
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.