# Catch user already registered Godot

**URL:** <https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633>\
**Category:** Game Design\
**Tags:** authentication, sdk-godot\
**Created:** [May 16, 2022, 1:56pm UTC](https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633 "2022-05-16T13:56:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luiscesjr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/luiscesjr/32/1155_2.png) [@luiscesjr](https://forum.heroiclabs.com/u/luiscesjr)\
**Post date:** [May 16, 2022, 1:56pm UTC](https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633/1 "2022-05-16T13:56:21Z")

</div>

Hi all, I’m trying to catch if user is already registered to the database.  
I understand this has been answered here: [How should I check if an account already exists to decide if the user should register or login? - Heroic Labs](https://forum.heroiclabs.com/t/how-should-i-check-if-an-account-already-exists-to-decide-if-the-user-should-register-or-login/658)

But godot does not handle exceptions, and that’s not an error to go through the is\_exception handler.

I see that the Session returns the values from here:

```auto
func _to_string():
	if is_exception():
		return get_exception()._to_string()
	return "Session<created=%s, token=%s, create_time=%d, username=%s, user_id=%s, vars=%s, expire_time=%d, refresh_token=%s refresh_expire_time=%d>" % [
		created, token, create_time, username, user_id, str(vars), expire_time, refresh_token, refresh_expire_time]

```

The way fthings are for now per docs are:

`print("Successfully authenticated: %s" % session)`

I’m trying for example to first just print that single variable form that return, but haven’t been able so far.

How should I catch that created bool and handle if user is already registered?  
Also, in a side note, is there a place where I can get a list of possible errors and codes to handle them accordingly?

Thanks!

EDIT:

Sorry, I have tried this before but it was throwing an error, I have no idea why I tried again and it worked.  
As simple as:

```auto
if !session.created:
			print("User already registered")

```

---

<div class="post-metadata">

**Author:** ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)\
**Post date:** [May 16, 2022, 4:41pm UTC](https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633/2 "2022-05-16T16:41:28Z")

</div>

Thanks for sharing your solution.

---

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [April 28, 2023, 8:31pm UTC](https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633/3 "2023-04-28T20:31:51Z")

</div>

In my case, users can login using Google, Facebook and Apple. When the player is already authenticated using google (for example) and he wants to also connect apple, I want it to succeed in 2 cases:

- apple account that he is trying to connect is free (isn’t connected to any other user)
- apple account is linked to the same Nakama user that the google is linked to

In other cases I want to get exception. As far as I investigated there is only one type of exception that Nakama sdk (for unity at least) throws and that is ApiResponseException. The only difference is that it has different status codes of exception. Somehow I found out that status code for Account Already In use is 409, so I can catch it that way, but is this the way? Aren’t there any other options?

Final questions:  
How to manage multiple social networks sign in to a same Nakama user? Do I have to have a single Session object for them? Do I have to use “Authenticate” method for each time when player logins to new social network (assume that they are connected to same Nakama user)?

As you might have noticed, I am weak in all that server stuff:( but I am open to reasearch!

---

<div class="post-metadata">

**Author:** ![UmarBhatPlaystrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/umarbhatplaystrom/32/1635_2.png) [@UmarBhatPlaystrom](https://forum.heroiclabs.com/u/UmarBhatPlaystrom)\
**Post date:** [April 29, 2023, 9:49am UTC](https://forum.heroiclabs.com/t/catch-user-already-registered-godot/2633/4 "2023-04-29T09:49:10Z")

</div>

Guys, I really need this. I didn’t found any documentation on this…
