question

Bryan C avatar image
Bryan C asked

Cloud script LinkServerCustomId bug.,Cloud script LinkServerCustomId bug

This will not set custom ID and returns no errors. I need to link custom ID.

var deviceLink = server.LinkServerCustomId({
        PlayFabId: currentPlayerId,
        ServerCustomId: deviceID,
        ForceLink: true
    });
,

This returns no errors but yet will not set custom ID for players even if custom ID is in use or not.

var deviceLink = server.LinkServerCustomId({
        PlayFabId: currentPlayerId,
        ServerCustomId: deviceID,
        ForceLink: true
    });
7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bryan C avatar image Bryan C commented ·

I received an email with your comment but comments are not showing up here. The code is simple. Executed cloud script from c# and returns fine. I am trying to set this with in an api call so I wouldn't need to make another API call to set device ID. The code executes correctly with out errors and var deviceLink does not return errors but it will NOT set the customID.

// Example
handlers.OnLogIn = function(args, context)[ var deviceID = args.deviceID; // This outputs the string correctly. log.info("Device ID: " + deviceID); // Does not return errors. But never sets customID. var deviceLink = server.LinkServerCustomId({
PlayFabId: currentPlayerId,
ServerCustomId: deviceID,
ForceLink: true
}); }
0 Likes 0 ·
Bryan C avatar image Bryan C Bryan C commented ·

Realized the [ instead of { in code. Can't seem to edit comments...

1 Like 1 ·
Turner avatar image Turner Bryan C commented ·

Okay how are you confirming that the customID has/hasn't been set? If you are looking under Identities in the Game Manager it will not be there if you are using LinkServerCustomId, try running something like GetServerCustomIdsFromPlayFabIds after you set the server custom Id. This will return the ServerCustomId for the provided PlayFabId.

0 Likes 0 ·
Bryan C avatar image Bryan C Turner commented ·

I have 2 test accounts and also have a login by custom ID. I manually check if IDs are set and used the response functions to check if errors return. Logging in with email will also calls the cloud script which is were it would initially set the device ID. The clients setcustomID works though.

0 Likes 0 ·
Show more comments
Show more comments

1 Answer

·
Turner avatar image
Turner answered

Yes, there is no LoginWithCustomID in the Server API, so you can't call it directly with CloudScript. Depending on what you need to do, you may be able to get around this by calling LoginWithCustomID on the client, then call a CloudScript function from the client and pass in the CustomID as an argument. I hope this helps!

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bryan C avatar image Bryan C commented ·

I wanted to set customID through cloud script not log in by it. Either way doesn't seem you can do it from cloud script. I'll just keep setting it from client.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.