Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Soloman Northrop · Aug 31, 2020 at 06:09 PM · Account Management

Get PlayFab ID From Twitch ID

Is there really no way to get a playfab user by their twitch ID?

I've linked a user's twitch account with their playfab account. I now need to (from a server-side background task) use the user's twitch ID to retrieve their playfab user account details. Is this currently impossible? Is there some other way to do this?

Thanks!

Comment

People who like this

0 Show 1
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Soloman Northrop · Aug 31, 2020 at 06:07 PM 0
Share

I should add that the "background task" is actually a twitch webhook so it's not actually linked to a request. Therefore I cannot use a token. All I have access to is the twitch user ID.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Soloman Northrop · Sep 01, 2020 at 02:32 AM

I came up with an short term solution:

1. Add this to your cloud script:

handlers._twitchGenericId = function(args, context) {
    var request = {
        PlayFabId: currentPlayerId
    };
    var result = server.GetUserAccountInfo(request);
    if (result["UserInfo"] && result["UserInfo"]["TwitchInfo"])
    {
        server.AddGenericID({
           PlayFabId: currentPlayerId,
           GenericId: {
               ServiceName: "Twitch",
               UserId: result["UserInfo"]["TwitchInfo"]["TwitchId"]
           }
        });
    }
}

2. Add a new segment with the following arguments:

3. Add an "Entered Segment" action of type "Execute Cloud Script" and select your cloud script.

4. Then whenever you're asking for the user on the server, use https://[yourTitleId].playfabapi.com/Server/GetPlayFabIDsFromGenericIDs

Make sure your body is setup like this:

{
    "GenericIDs": [
        {
            "ServiceName": "Twitch",
            "UserId": 204940653
        }
    ]
}

--------------------------------------

Now, whenever you get a response for the generic ID, you'll get back the user's playfab ID.

While this is nice, it's not an official solution, I'd much prefer there be a way to grab the playfab ID from twitch user ID on the server; just like you can with all the other services.


xazya.png (51.4 kB)
o6ngl.png (50.4 kB)
Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Citrus Yan ♦ · Sep 01, 2020 at 03:27 AM 1
Share

You can make a feature request of adding GetPlayFabIDsFromTwitchIDs into the server API set in here: https://community.playfab.com/spaces/24/index.html, that would help you for your case.

avatar image Soloman Northrop Citrus Yan ♦ · Sep 01, 2020 at 11:28 AM 0
Share

Thank you! I hope to hear back. This would be extremely helpful for us :) (idea here)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Link cross-device with the same account 1 Answer

    Searching on non-unique title display names 1 Answer

    Facebook Friends added even if no Title ID... Master accounts with phantom game accounts... and more player profile craziness!!! 1 Answer

    How to fix creating a new user on iOS every time app is uninstalled and installed again 3 Answers

    Delete player throught cloudscript 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges