lowcoder icon indicating copy to clipboard operation
lowcoder copied to clipboard

[Bug]: Generic OAuth login Failed

Open tiodot opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I config a salesforce OAuth with the Generic auth type. I login with salesforce account successfully at the first time, but failed then.

While I try to login, there will occur an error: image

And the server error log is:

 o.l.api.framework.exception.GlobalExceptionHandler#lambda$doLog$8:155  POST /api/auth/tp/login [nioEventLoopGroup-3-9]:  
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "org.lowcoder.domain.user.model.Connection.getRawId()" is null
        at org.lowcoder.api.authentication.service.AuthenticationApiServiceImpl.lambda$getAuthConnection$18(AuthenticationApiServiceImpl.java:240)
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoFlatMap] :
        reactor.core.publisher.Mono.flatMap
        org.lowcoder.api.authentication.service.AuthenticationApiServiceImpl.updateOrCreateUser(AuthenticationApiServiceImpl.java:158)
Error has been observed at the following site(s):

Expected Behavior

Can use the salesforce account to login lowcode successfully.

Steps to reproduce

  1. self-host the lowcoder;
  2. config the user authentication with oAuth
  3. login with the salesforce account, and login in other device or just logout then login again.

Environment

self-host lowcoder 2.4.4

Additional Information

Data in mongodb seems missing the rawId while using the OAuth:

// normal
connections: [
      {
        authId: 'EMAIL',
        source: 'EMAIL',
        rawId: '[email protected]',
        name: '[email protected]',
        email: '[email protected]',
        orgIds: [],
      }
    ]

// exception
connections: [
      {
        authId: 'xxx',
        source: 'GENERIC',
        name: 'xx',
        email: '[email protected]',
        avatar: '-',
        orgIds: [ '-' ],
        authConnectionAuthToken: {
        },
        rawUserInfo: {},
       tokens: [],
  }]

tiodot avatar Aug 15 '24 08:08 tiodot