Retrieving Access Token from Google Play Games

I know that many of you asked about retrieving Access Token from Google Play Games in UE4. After some research and investigating issue, I’ve just made pull request with this functionality added.

Access Token allow you calling any REST API for Google Play Games so it’s a huge deal! More info: Enabling Server-Side Access to Google Play Games Services

You can wait when Epic merge these changes into engine or grab it now from GitHub repository: https://github.com/EpicGames/UnrealEngine/pull/2372

If you have any questions, ask me :slight_smile:

This is really awesome! Was just wondering how to get the access token to use with the Google Play REST API! Is this exposed to blueprints though? Currently I can’t find it :frowning: (testing in 4.15)
Many thanks in advance for your help!

You can do this in C++ calling:



IOnlineIdentityPtr OnlineIdentity = OnlineSubsystem->GetIdentityInterface();
if (OnlineIdentity.IsValid())
{
      OnlineIdentity->GetAuthToken(0);
}


Many thanks for the reply gameDNA! However I was hoping to keep my project BP only - or at least as much as possible so using the access token in BP - how can I pass that code to a blueprint variable?

It’s not currently available in Blueprints :frowning:

Which headers do I need to include to call this? I tried adding to an new C++ class and get:

Thanks in advance for the info!

PS: This could be a great feature to add to your MobileUtils plugin btw (get value via blueprint :slight_smile: )

IOnlineIdentityPtr is in OnlineSubsystem.h. Add “OnlineSubsytem” as a private dependency.

Functionality requested by you added to the new plugin release: [FREE] Mobile Utils - mobile community project - Mobile - Epic Developer Community Forums :smiley:

gameDNA, I get “INVALID_TOKEN” message if I run the code excerpt above on Android based game and try to get the authentication token from Google Play store. I’m running UE 4.18.3, testing it on a signed shipping apk for distribution. The Sign-in happens successfully, it’s just that I need the token for one of your plugins (UMK).Any suggestions as to how I can get the authentication token?

Hello,

we added to the Ultimate Mobile Kit better function for this task. Please check new node Sign In With Google: https://forums.unrealengine.com/unreal-engine/marketplace/111498-ultimate-mobile-kit-for-ios-android-firebase?p=1457287#post1457287