Path prefix
See original GitHub issueI have an api that I have mounted on an url like this:
http://localhost/v2/social/
My provider callbacks are configured like this:
/v2/social/connect/twitter/done
The callbacks in between however, do not know about the /v2/social
part. These callbacks will come back to http://localhost/connect/twitter/callback
.
I tried setting the grant.server.host
to localhost/v2/social
, but this didn’t work. I dived a bit into the source code and added a quick fix to be able to specify path
prefix options. I tried it with express and it seems to work.
Here is what I did: https://github.com/arjanfrans/grant/commit/b18df7033fa8756ef8e18dadc8bcc0c9df880df1
In the config I then have something like this:
{
server: {
protocol: 'http',
host: 'localhost',
transport: 'session',
path: '/v2/social'
},
twitter: {
key: 'keyhere',
secret: 'secrethere'
callback: '/connect/twitter/done'
}
}
To me it seems like a missing feature. It would be nice to see it integrated. I could work on a proper pull request if I have some time next week.
Thoughts?
Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
I think it should work out of the box if you set your
host
property tolocalhost/v2/social
and mount Grant with that prefix:But I don’t like using the
host
property like that, also I haven’t tested it myself so it might not work. Either way I’ll figure out the best way to add this feature these days. I’m also going to add a new example and I’ll probably update the docs as well.Thanks for contributing 👍
Version 3.6.0 is published.