Comments (11)
Hi, @dominiksteiner, thanks for reaching out. I noticed that fork, and I'll take a look at it these days 👍
Generally adding a new provider is just a matter of adding a configuration in the config/oauth.json
. The amount of other changes needed depends on how much exactly the provider in question deviates from the official OAuth specification.
On a side note: having configuration like gdrive
and gmail
in config/oauth.json
is not needed. You can define static overrides in your configuration:
"google": {
"gdrive": {"scope": []},
"gmail": {"scope": []}
}
Then navigate to /connect/google/gdrive
or /connect/google/gmail
.
from grant.
There you go 2ecc996 @szafarcin @dominiksteiner let me know what do you think.
The next release will be published the next week, so in the meantime you can pull master and test.
The output format is as follows:
{
"access_token": "...",
"refresh_token": "...",
"raw": "raw xml string"
}
If you need anything else than the access_token
and the refresh_token
you can parse the raw
key on your own.
from grant.
wow, incredible, looks good, will test it, thanks for this quick integration.
from grant.
Also what's currently missing from the docs is that the following is identical:
// Express
var Grant = require('grant-express')
var Grant = require('grant').express()
// Koa
var Grant = require('grant-koa')
var Grant = require('grant').koa()
// Hapi
var Grant = require('grant-hapi')
var Grant = require('grant').hapi()
For Koa you need two additional dependencies:
thunkify
andkoa-route
So you can require Grant directly in your app, without the need of meta module.
from grant.
Thanks, that's useful information too.
from grant.
@simov, just tested concur change seems to be returning access/refresh tokens fine.
However there is a slight further requirement based on the same fork. We are passing custom variables to corresponding callback if they are present in initial request. If you take a look at utils.js, we are binding variables (id,pwd,xsp,rurl etc) to provider and retrieving them in the callback for further use.
What do you suggest a best way to utilize such feature in grant?
Thanks
from grant.
Hi, @szafarcin, I'm not seeing such parameters in the official API docs.
That seems to be part of your own application logic. If I'm understand you correctly you want to store some user data and use it in the final callback? If that's the case the easiest way would be to store it in the user's session on connect
and then access it in the final callback.
from grant.
Hi @simov ,
Yes correct, I was referring to variables mapped in https://github.com/szafarcin/grant/blob/master/lib/utils.js
Correct me if I am wrong regarding storing in session wouldn't that be part of grant itself as "connect" is called inside, and external app which uses grant just has the callback hook?. So what do you suggest for hooking data without changing in grant master. Thanks
from grant.
I think we're on the same page. The first thing that comes to my mind is this:
// navigate to /connect_concur instead of /connect/concur
app.use('/connect_concur', function (req, res) {
req.session.user = {
// store the current user's data
}
res.redirect('/connect/concur')
})
app.use('/final_callback', function (req, res) {
// depending on your configuration
// the OAuth response data is either in:
req.query
// or
req.session.grant
// the user's data that you stored previously in the connect route is in:
req.session.user
})
Storing user data in grant.config
is actually a bad practice. If you have two users connecting at the same time, the user data there will be incorrect. That's why it's better to store the user's data in its session.
from grant.
@simov thanks a lot for the clarification, and valuable input.
from grant.
Version 3.5.1 is published.
from grant.
Related Issues (20)
- 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
- Is it possible to pass arbitrary data in? HOT 1
- Grant playground open-source? HOT 1
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.