Can't create user for App42 Leaderboard

0 votes

Hello.

I can't create a user in the App42 cloud with this script, what is wrong in it?

  1. using UnityEngine;
  2. using System.Collections;
  3. using com.shephertz.app42.paas.sdk.csharp.user;
  4. using com.shephertz.app42.paas.sdk.csharp;
  5. using System;
  6. using UnityEngine.UI;
  7.  
  8. public class Reg : MonoBehaviour
  9. {
  10. public Text U;
  11. public Text P;
  12. public Text E;
  13. LeaderBoardConstants cons = new LeaderBoardConstants();
  14. public void Activate()
  15. {
  16. App42API.Initialize(cons.apiKey, cons.apiKey);
  17. UserService userS = App42API.BuildUserService();
  18. userS.CreateUser(U.text, P.text, E.text, new UnityCallBack());
  19. }
  20. }
  21.  
  22.  
  23. public class UnityCallBack : App42CallBack
  24. {
  25. public void OnSuccess(object response)
  26. {
  27. User user = (User)response;
  28. /* This will create user in App42 cloud and will return User object */
  29. App42Log.Console("userName is " + user.GetUserName());
  30. App42Log.Console("emailId is " + user.GetEmail());
  31. }
  32. public void OnException(Exception e)
  33. {
  34. App42Log.Console("Exception : " + e);
  35. }
  36.  
  37. }
  38.  

These codes are saved in one file that is called "Reg.cs" and the public function is used when player hits a button. Althogh this script shows exceptions but it doesn't show any coniformation and in the App42 user section in the app42 website, no new profile is shown.

 

asked Aug 23, 2015 in App42 Cloud API-BaaS by d.pichgah (17 points)

1 Answer

+1 vote
 
Best answer

Hi,

You are passing apikey in the second parameter while initialising the App42API:

  1. App42API.Initialize(cons.apiKey, cons.apiKey);

The second parameter must be SecretKey which you can get from AppHQ Console. If you stil get exception after providing the secret key then please share the exception log you are getting. It will help to debug the problem.

Let me know if the problem continues.

Thanks.

answered Aug 23, 2015 by rajeev.etc (1,660 points)
selected Aug 23, 2015 by d.pichgah
Thank you so much, I even had double checked the code and didn't notice that! Now this is working and I see a new created user in the User section of the App42 dashboard with success.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...