Comments (4)
If I may ask, why do you want to setup a different path for the callback in the first place?
From what I understood when you query your endpoint, /login
in your example, the handler of your route is only reached once the user is successfully authenticated through the third-party system. The intermediary steps are handled for you by bell
. If you want to have the hand over these intermediary steps then I'm not sure there is a point to use bell
then. From the docs:
bell works by adding a login endpoint and setting it to use a bell-based authentication strategy. bell will manage the third-party authentication flow and will only call the handler if the user successfully authenticated.
Source: https://hapi.dev/module/bell#usage.
As per your question, I don't think you can change to a different redirect path.
from bell.
For example, for the login endpoint I will expect some query parameters that I would like to validate and on callback endpoint I will not validate those parameters. And I don't like the idea of starting a login process and ending it (callback process) done on the same endpoint. I am using bell with "custom strategy", so I like that bell provides functionalities but if it is possible to change the callback route that would be nice.
Usage without a strategy
Sometimes, you want to use bell without using specifying a Hapi strategy. This can be the case when combining the auth logic together with another module.
bell exposes an oauth object in its plugin. Therefore, server.plugins.bell.oauth now has all that's needed. For example, calling the v2 method with all the settings documented above, will handle the oauth2 flow.
from bell.
For the checks on your query parameter, depending on the checks you want to make you could validate them directly in your route configuration through joi
schemas. If you want deeper validation i.e database checks you can try using a lifecycle endpoint that happens before credentials validation/auth logic like onRequest
.
As of now, I'm not sure you can separate your callback URL to the starting point URL.
from bell.
? As of now, I'm not sure you can separate your callback URL to the starting point URL.
I did it by setting the location
as function
const basicSettings = {
provider: {
protocol: 'oauth',
profileMethod: 'post',
signatureMethod: 'RSA-SHA1',
},
providerParams: false,
allowRuntimeProviderParams: false,
cookie: settings.cookieName,
skipProfile: true,
forceHttps: false,
location (request) {
if (request.query.oauth_verifier) {
return request.server.info.protocol + '://' + request.info.host + '/foo';
}
return request.server.info.protocol + '://' + request.info.host + '/bar?xyz=' + encodeURIComponent(request.query.custom);
},
};
from bell.
Related Issues (20)
- How to get facebook profile picture with custom size? HOT 5
- Support for idp with self signed certificates HOT 3
- Only node 12
- Require hapi 19
- Change plugin name to @hapi/bell
- Expose public API to refresh tokens HOT 2
- Replace Yahoo Social Directory Web Service HOT 2
- Issue with the meetup provider HOT 1
- "Failed obtaining twitch user profile" when using Twitch provider HOT 4
- Support functions for `provider.auth` and `provider.token` HOT 2
- Sign in with apple HOT 5
- Using for 3rd party tenants HOT 3
- docs: api page tutorial links to dead page HOT 1
- Improve the debugging experience when a payload is involved HOT 1
- Please document usage of local strategy
- Support client credentials as functions HOT 3
- Improve handling of rate limiting by Okta provider
- Add timeout configuration for requests
- Big cookie size
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 bell.