Skip to content
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

createJwtPayload called without services info on registration #1055

Open
tennox opened this issue Sep 13, 2020 · 0 comments
Open

createJwtPayload called without services info on registration #1055

tennox opened this issue Sep 13, 2020 · 0 comments
Labels

Comments

@tennox
Copy link
Contributor

tennox commented Sep 13, 2020

Bug report

Describe the bug

createJwtPayload called without services info on registration:

user = 
  id: '5f5e0fce4a1a0a54777a7d9f',
  services: {},
  ...
}

even though getRegistrationPayload is called before that.

When I log out & log in again, it is called correctly:

{ services: {
    nextcloud: {
      ...
    }
} }

To Reproduce

const accountsServer = new AccountsServer<OurUser>(
    {
      // The database adapter used for the users and sessions
      db: new MongoDBInterface(db),
      // A strong random secret
      tokenSecret: config.get('accounts.secret'),
      createJwtPayload: async (data, user) => {
        console.log('Customizing JWT:',data,user)
        const nextcloudData = _.get(user.services, 'nextcloud')
        // ...
      },
    },
    {
      oauth: new AccountsOauth({
        nextcloud: new AccountsNextcloudProvider(),
      }),
    },
    
  )

Expected behavior

createJwtPayload is called with services info also the first time.

System information

├─ @accounts/[email protected]
│ ├─ @accounts/types@^0.29.0
├─ @accounts/[email protected]
├─ @accounts/[email protected]
│ ├─ @accounts/types@^0.29.0
├─ @accounts/[email protected]
│ ├─ @accounts/types@^0.29.0
├─ @accounts/[email protected]
│ ├─ @accounts/two-factor@^0.29.0
├─ @accounts/[email protected]
│ ├─ @accounts/types@^0.29.0
├─ @accounts/[email protected]
│ ├─ @accounts/types@^0.29.0
├─ @accounts/[email protected]

@tennox tennox added the bug label Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant