We are trying to make the auth work with AzureAD, and i keep getting into weird situations where it seems like after one user has been correctly logged in, database and auth wont be updated to a new user afterwards.
Expected behavior
Simple Log in && Log off behavior.
Actual behavior
a. When the database is empty and no-one has logged in previously user gets logged in correctly and everything is registered into the database by feather.
b. When there WAS already someone logged in and registered in the database, new connections wont work, you stay logged in as the first user, and the database is not updated.
Here is my server code:
module.exports = function (app) {
const config = app.get('authentication');
// Set up authentication with the secret
app.configure(authentication(config));
app.configure(jwt());
app.configure(local());
app.configure(oauth2(Object.assign({
name: 'azure-ad',
Strategy: OIDCStrategy,
passReqToCallback: true,
successRedirect: 'https://localhost:3000',
failureRedirect: 'https://localhost:3000/oauth_error',
entity: 'user',
service: 'users',
}, config['azure-ad'])));
app.service('authentication').hooks({
before: {
create: [
authentication.hooks.authenticate(config.strategies)
],
remove: [
authentication.hooks.authenticate('jwt')
]
}
});
};
And my client code:
import feathers from '@feathersjs/feathers';
import socketio from '@feathersjs/socketio-client';
import io from 'socket.io-client';
import auth from '@feathersjs/authentication-client';
const socket = io('https://localhost:3030', {
transports: ['websocket'],
forceNew: true,
});
const feathersClient = feathers();
feathersClient.configure(auth({
storage: window.localStorage,
cookie: 'feathers-jwt',
}));
feathersClient.configure(socketio(socket));
export default feathersClient;
You may have to customize the verifier if the default user lookup (by options.idField) doesn't work. It will probably use undefined since it got never set and always return the first entry that matches.
We are trying to make the auth work with AzureAD, and i keep getting into weird situations where it seems like after one user has been correctly logged in, database and auth wont be updated to a new user afterwards.
Expected behavior
Simple Log in && Log off behavior.
Actual behavior
a. When the database is empty and no-one has logged in previously user gets logged in correctly and everything is registered into the database by feather.
b. When there WAS already someone logged in and registered in the database, new connections wont work, you stay logged in as the first user, and the database is not updated.
Here is my server code:
And my client code:
And finally, my featherJS configuration:
System configuration
Module versions
NodeJS version: v10.3.0
Operating System: Ubuntu 16.04
Browser Version: Firefox 60.0.1 (64-bit)
React Native Version: /
Module Loader: RequireJS