Closed yomybaby closed 4 years ago
This look like expected behavior to me. Create0AuthUser
just creates a user.
Lets say I have to two users creating accounts at the same time. Are they two separate users or same user?
I think that this is a bug. With the same auth data, it have to create only one user.
Lets say I have to two users creating accounts
using same SNS account
at the same time. Are they two separate users or same user?
This answer is "same user", right? Because they are using same SNS account.
Create0AuthUser
use same auth data(id) every times. (link)
For example, If you try to signup/login with the same facebook account many times,
Existing test code test it only in a serial way not In a parallel way.
@dplewis I got a pain with same issue. 🐛
Sometimes multiple same accounts(having same authData) are created by multiple request from the one user when I use linkWith()
for social login. And unique check is not work through username
because username
of _User
is randomly generated.
This situation happens by poor connection, slow DB, request by fast double click and so on. In my case, I got a bunch of duplicated users when my db server was slow. And they threw one star to my application 😭
I suggest the option for auth
options to choose username
from authData. or integrate username
generation to adapter.
For example,
Apple authData's form is apple: {id: 'xxxx', token: 'aaa'}
.
And we want to generate unique username
from apple.id
new ParseServer({
...
auth: {
kakao: kakaoAuthAdapter,
apple: {
client_id: process.env.APPLE_SIGNIN_CLIENT_ID,
username: 'apple.id'
},
},
...
})
Or in adapter,
_createClass(Apple, [{
key: "uniqueUsername",
value: function validateAuthData(authData, options) {
return authData.apple.id
}
...
Issue Description
AuthenticationProviders should only create a single user with REST API.
AuthenticationAdapters.spec.js
has a test case for this.This test case try to make two
POST
request with the sameauthData
in a serial way. In a parallel way, it can make double users.Steps to reproduce
I wrote a test case for this.
Please add this case to
AuthenticationAdapters.spec.js
and run test.Expected Results
Test pass.
Actual Outcome
Test fail
example output
Environment Setup
Server
Database