# User detected as new user (other auth providers)

**URL:** <https://community.parseplatform.org/t/user-detected-as-new-user-other-auth-providers/2563>\
**Category:** Cloud Code\
**Tags:** discussion\
**Created:** [April 2, 2022, 3:23pm UTC](https://community.parseplatform.org/t/user-detected-as-new-user-other-auth-providers/2563 "2022-04-02T15:23:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meglali20](https://community.parseplatform.org/user_avatar/community.parseplatform.org/meglali20/32/934_2.png) [@Meglali20](https://community.parseplatform.org/u/Meglali20)\
**Post date:** [April 2, 2022, 3:23pm UTC](https://community.parseplatform.org/t/user-detected-as-new-user-other-auth-providers/2563/1 "2022-04-02T15:23:05Z")

</div>

I am encountering an issue with parse server, I did post the issue on github

> <https://github.com/parse-community/parse-server/issues/7737>
>
> \### New Issue Checklist
> \<!--
> Check every following box \[x\] before submitti…ng your issue.
> Click the "Preview" tab for better readability.
> Thanks for contributing to Parse Platform!
> \--\>
> 
> \- \[x\] I am not disclosing a \[vulnerability\](https://github.com/parse-community/parse-server/blob/master/SECURITY.md).
> \- \[x\] I am not just asking a \[question\](https://github.com/parse-community/.github/blob/master/SUPPORT.md).
> \- \[x\] I have searched through \[existing issues\](https://github.com/parse-community/parse-server/issues?q=is%3Aissue).
> \- \[x\] I can reproduce the issue with the \[latest version of Parse Server\](https://github.com/parse-community/parse-server/releases). 
> 
> \### Issue Description
> 
> \-A user is being detected as new when he isn't.
> \-authData field being deleted for unknown reasons.
> 
> \### Steps to reproduce
> 
> Add the following code to the cloud code and try to login using Facebook, Twitter, or Google.
> \`\`\`
> Parse.Cloud.afterSave(Parse.User, async (request) =\> {
> if (!request.original) {
> "need to perform some actions here when a user has just signed up"
> }
> });
> \`\`\`
> \### Actual Outcome
> 
> This issue leads to performing unwanted actions over a non new user.
> After a user performs a login/signup through Facebook, Twitter, or Google, the user is always being detected as a new user in afterSave. 
> When checking again in the database you can see that the same user has just logged in and it's not a new one, 
> Noticed also something with the authData field, when testing login with different methods the authData is being erased(doesn't happen all the time).
> 
> \### Expected Outcome
> 
> Not detect a user as a new one when he isn't.
> 
> \### Environment
> 
> 
> Server
> \- Parse Server version: \`parse-server@5.0.0-alpha.3\`
> \- Operating system: \`Windows 10\`
> \- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): \`Local\`
> 
> Database
> \- System (MongoDB or Postgres): \`MongoDB\`
> \- Database version: \`FILL\_THIS\_OUT\`
> \- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): \`MongoDB Atlas\`
> 
> Client
> \- SDK (iOS, Android, JavaScript, PHP, Unity, etc): \`Android\`
> \- SDK version: \`1.26.0\`
> 
> \### Logs

But the issue seemed to be considered as a question rather than a bug, even after that a user confirmed having the same issue.  
To summarize the issue, if you want to perform some actions only when a user signs up using email/username there is no issue (in my case create some data related to that user and get pointers for it), if the user signs up using Facebook/Google/Twitter to create an account the action performs correctly, but if the user connects again the parse server detects him as a new user each time which leads to the afterSave trigger being triggered each time the user performs a login.  
The user that confirmed having the same issue proposed this

> This is an issue I had when I created my own auth provider (custom 2fa), and when ever users login using that auth provider an after save triggers for the user as a newly created user, my workaround was to create a lock object when the user is created in beforeSave so when after save I check if that lock exists then yes it is a new user otherwise it is this bug.

The solution will force you to add maybe another class or column, I can’t rely on this one due to the complexity and the size of what I already have.  
Any ideas or solutions are welcome, thanks.

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [April 4, 2022, 6:39pm UTC](https://community.parseplatform.org/t/user-detected-as-new-user-other-auth-providers/2563/2 "2022-04-04T18:39:32Z")

</div>

I see some open comments on your PR and I’ve just left one more. Could you please check it out?
