Comments (6)
What you are looking at is in fact a middleware. Can you give me a short code example showing what are the other possible options to define a middleware?
from grant.
I mean avoid having to do mount
.
With mount
you are essentially wrapping oauth into it's own koa app, and since it's a koa app, it comes with koa module dependencies, and creating problems for project that use a different session solution, or even just a different version of the same module.
It would be more flexible to transform koa this
context alone, and leave router and session management independent (abstract them so that developers can write adapters to make other modules to work with grant
).
from grant.
@bitinn check out this commit 9204806
The Koa middleware no longer require specific session store to use, but it is required to use one and set it before mounting grant.
I tested it with a bunch of session store modules here https://github.com/simov/grant/tree/master/example/koa-session
I'll update the docs prior releasing the new version (which will be around the end of this week)
This solves the session issues.
As for the koa-router module take a look at the examples again https://github.com/simov/grant/tree/master/example/koa-session there in my consumer application I'm using koa-route instead. So using koa-router is not required. As far as the middleware order goes, you should put session and grant on top, if mounting koa-router before grant doesn't work, then you should put it after it.
from grant.
@bitinn check out this commit 908b9a8
The Koa middleware no longer depends on koa-router, so you can mount it in your app wherever you want. I'll let you know when the new release is out.
from grant.
Thx, i will get to test it soon :)
from grant.
@bitinn version 3.0.3 is published on NPM. Thanks for the feedback 👍
from grant.
Related Issues (20)
- Salesforce oAuth not working HOT 3
- Do you know an example of Grant setup in SvelteKit project? HOT 3
- Intended method of accessing session.grant HOT 2
- Discord Profile route always 401 Unauthorized HOT 7
- Recommended approach for handling config without checking into git HOT 1
- Support Deno? HOT 3
- iFrame redirect issue with Shopify oAuth HOT 4
- OAuth 2 state - how can I associate a successful grant with a user id HOT 5
- Is there a framework-agnostic API? HOT 1
- Telegram Oauth HOT 2
- Export the grant config and Options HOT 4
- Not working with Next 13 App Router
- How to use dynamic params in custom_params of grant? HOT 1
- Autodesk deprecated v1 (lib's current) oauth endpoints HOT 4
- Incorrect inclusion of client_secret for authorization_code grant in OAuth2 implementation HOT 1
- Switch to OAuth 2 for OpenStreetMap provider HOT 1
- Itch.io authentication HOT 2
- Alternating Domains HOT 5
- Allow to customize "missing provider" error URL? HOT 3
- Any Help to Implement Grant in Next JS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grant.