Cannot sign up though AvatarCreatorWizard

Hello, i am trying to sign up thought the unity app, i tried at AvatarCreatorElements scene it works but always fail at AvatarCreatorWizard scene.
{“status”:500,“message”:“internal server error occurred”,“type”:“InternalServerError”}
OTP login are not good for my user to login again inside the app.

Also, may i know how to let user update the avatar using user_id and avatar_id only?

thanks

Hello and welcome to the forum!
What Unity SDK version are you using? and when exactly does this error occur? For instance, does it happen after submitting a photo or selecting a template avatar?

Hi, i am using SDK 6.1.2,
i just open the scene AvatarCreatorWizard, selected the avatar and after than i want to register as a new user and input the email and it return {“status”:500,“message”:“internal server error occurred”,“type”:“InternalServerError”}

Also, may i know how to get the avatar data(which user can edit the avatar) using user_id and avatar_id inside unty?

We were able to replicate the issue. The team is looking into it, and it will be fixed soon. It seems like a non-blocking issue since the email still gets sent. Can you confirm that you got the email on your side too?

I think i can get the email.
So may i know how to update the avatar using user_id and avatar_id inside unity? Both webGL and Mobile platform. Thanks

If you want to update the avatar with the wizard/Elements scene, then it already includes everything you need. The Elements scene is more open, understandable, and easy to follow.
But if you want to update avatar within your code, outside of our avatar creators, then you can check how it is done in the AvatarCreatorElements scene in the SimpleAvatarCreator script.
Right now it:

  • Creates a user
  • Creates avatar for the user
  • Contains methods to update the avatars

AvatarManager is a class that does most of the heavy lift for you. (create, update, save, delete) avatars. The only thing that you need to do in that case is that you need to have user logged in or use anonymous users, and you need to know the IDs for the assets you want to apply to your avatar.

Thanks for your replay, i am using anonymous users login and success to load the avatar by LoadAvatar() with assiged avatarID, but while i want to update the avatar(select the assets), it return 403 Forbidden Error by calling UpdateAsset()

Url:https://api.readyplayer.me/v2/avatars/[avatar-id]?responseType=glb&

Payload:{
“data”: {
“assets”: {
“hairStyle”: “143343048”
}
}
}

Also, may i know how many avatar can under one user_id and how long does it last if the avatar_id are created by guest user or anonymous users?

Thanks

Regarding the error, are you sure that the avatar created belongs to the user? (There is avatarListElement, that you can use to see all of the user avatars). And also, is the hairstyle available for the account?

The avatars don’t expire. You can also create multiple avatars for anonymous accounts.

Actually i only got the UseID and the AvatarID, is there any method can Update the Avatar by the AvatarID without login using email and code?

Inside AvatarCreatorElements, all of the POST/PUT API are using authorizedRequest which access to UserSession.Token, but i don’t know how to create the UserSession by using UserID only.

You can’t create a session using UserID. You have two options that both return you the token:

  • Log in with email and code
  • Create a new anonymous account

If you want to restore user session of your user, then you need store it on your end and create a mapping.
UserId → Token

OK thanks, so i can get the userid and token while login as anonymous and store it on my side, so how about the refresh token, what is it use for?

When the user is not anonymous (Signed in via email), you have to refresh the token every 15 minutes. So you would need to store both refresh and regular token. SDK already has functionality to do that, when AuthManager.UserSession is set up correctly.

Thanks, so my flow should be using anonymous to login , store the userid and token,
after created the avatar and store the avatarID
And on the next day , login again by those userid and token again to update the avatar?

Yes this is the flow

Thanks for your help, one more question, which function/api should i use to login as anonymous using the userid and token, or i just apply those to the user sssion is ok?

Just apply those to userSession. An example is available here.

Hello, an other question , how can i call the other script which under assts/scripts/scenemanager.cs in GameManager where belongs to ReadyPlayerMe.Samples.AvatarCreatorWizard?

Hello, there are many ways to reference methods from another script. One way to do it for this example is to reference the gameObject that has the script you want to call attached to it, and then from that reference, you can access the script component in the other script. For example:
ExampleGameObject.GetComponent<OtherScript>()

More about GetComponent in the Unity documentation: Unity - Scripting API: GameObject.GetComponent

For this example, because the GameManager script is within the namespace ReadyPlayerMe.Samples.AvatarCreatorWizard, you can either include your new script into that namespace too (By adding namespace ReadyPlayerMe.Samples.AvatarCreatorWizard { at the beginning of the script and don’t forget to close the bracket at the end of the script } + you move your script under the AvatarCreatorWizard/ scripts folder) or create a new namespace and corresponding Assembly Definition and then including the namespace on the script where you would want to use it.

More about Namespaces in the Unity documentation: Unity - Manual: Namespaces

More about Assembly definitions in the Unity documentation: Unity - Manual: Assembly definitions