New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing tokenUserNotFound for custom authentication: comment stream does not appear #2188

kaichristiansen opened this Issue Feb 9, 2019 · 2 comments


None yet
2 participants
Copy link

kaichristiansen commented Feb 9, 2019

I have implemented a very simple tokenUserNotFound method based on the documentation. It simply takes the relevant values from the token (jwt argument) and returns them as a profile object. (That is, I am not yet bothering to do a real service call to my external database). A new record is properly inserted in mongoDB the first time, but the commenting widget just "hangs". There is no specific error that I see in the docker logs for the talk container, but, there is an error message displayed in the browser in a black div at the bottom of the viewport. Spinning waiter icon never clears:

"GraphGL error: Cannot return null for non-nullable field UsernameStatus.status"

Here is my "dead simple" tokenUserNotFound method which is being called:

`const UserModel = require('../../models/user');

module.exports = {

tokenUserNotFound: async ({jwt, token}) => {
    //let profile = await someExternalService(token);
    let profile = (jwt.sub.user) ? jwt.sub.user : null;
    if (!profile) {
        return null;

    let user = await UserModel.findOneAndUpdate({
    }, {
        username: profile.username,
        lowercaseUsername: profile.username.toLowerCase(),
        roles: [],
        profiles: []
    }, {
        setDefaultsOnInsert: true,
        new: true,
        upsert: true

    return user;



This comment has been minimized.

Copy link

kaichristiansen commented Feb 12, 2019

Per an email from support about using a custom auth plugin such as this, I have disabled ALL OTHER plugins that I had active (e.g. I had started from the onbuild image and used the plugins.default file as the initial set). So, the ONLY plugin that is enabled in mine, with this tokenUserNotFound method. I had asked about how to get the email associated as well and, per support, added the email property here as well, and updated the code above to reflect that.

Still the same GraphQL error div in the browser, the spinning waiter, and no comment form. I am stuck here. Thanks for any advice/debugging, etc.


This comment has been minimized.

Copy link

immber commented Feb 13, 2019

The error "GraphGL error: Cannot return null for non-nullable field UsernameStatus.status" is caused by a failure to set UsernameStatus.status. It's recommended in our doc's to use upsertExternalUser for custom SSO integrations as that method automatically handles the username status.

For reference, details about what is triggering the UsernameStatus error can be found here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment