Google Play Services authentification in client-server application - android

I'm developing a client and a server for online game. To make login process easier for users we planning to make enter in game via Google Play Services account.
The problem is that authentification proceeds on client side only, but server needs to create some account for authetificated user too, to store info about his achievements, items and so on.
The question is - how to do it? Which info from Player Services we could store to create account, and authentificate user in further?
Maybe someone had similair experience, i think there should be some simple solution for that.

If you want to setup your Google Play Service using client-server, then I think this documentation can help you with that. It explains here the step by step procedure that you need to do in order to setup the Google Play Service. For more information just read the above link and check this thread. Also, if you want the client-only then this link will help you.

Related

Is there a way how to programatically acces my Google Wallet Merchant Account, so I can check from my phone easily how much I make every day etc?

I am developer, selling my apps.
But I dont always have access to my PC, so I was thinking writing a simple app which would access my Wallet Account to see how much I earned this day/week/month.
Is there any API and some working example how to do this? THanks
Do you know about the official Play console app? It lets you check financial data among other things, like reply to reviews.
If you do need programmatic access there isn't an API, but you can Download reports from Google Cloud Storage which has an API. There are instructions on that page for both a command line tool access and a client library and service account.

how to track referral link on android

I've an android app available on google play store and I want to create a referral system to engage users to share.
The app already has an share button which creates a link like:
Hey, have a look at this app...https://play.google.com/store/apps/details?id=com.tomatedigital.&referrer=utm_source%3Dapp_referral_USERID
this way i can monitore through google play console and firebase dashboard which links generated downloads, it show the information pretty nice but i need to automatically get it.
would be awesome if i could get it inside the app so i show the sign up for to the user with the referer already filled... but i strongly think it's impossible
but if somehow i can get this information from google play console I could write a script which runs once per day and update the bonus to users with most shares
is that possible? how can i implement a referral system like this?
This can be done with the Google Play referral API which has some more docs here

How do you gift in-app purchases

I am building a website for a client that is promoting an App on Kickstarter. As one of the rewards this client wants to reward sponsors with in-app purchases. I have searched Apple and posted on other forums but I can't find out if this is possible and if it is possible, how it is done.
Thanks.
You need to implement a promo-code dialog inside your app to do that, then send promo-codes to your Kickstarter users.
I don't think It's possible.
Here's the only Google documentation I could find.
You could make the app free for a short period until all backers have their copy and then raise the price but non backers will be able to download it too.
It would be possible however to use the alpha/beta functionality in the Google Play store to release the app to backers who have joined specific circles setup by you. I don't know if Google would have a problem with you using it like this.
It might be possible to distribute the app outside of the Play Store but I suspect that will become a big support problem as users struggle to get the app installed and keep it up to date.
For iOS part we haven't this functionality with Store Kit. This framework was created to securely process payments from users. You don't need to work with payments. Just deliver some product or an extra functionality to user with promo code. Implement a dialogue in your app where user can enter his code, send this code to your server, check it and give an access for user, if code was right. That's all you need. After making the product available, your app needs to make a persistent record of the "purchase" like you do with normal in-app purchases.

SSO with Google account on both website and mobile app

I'd like to use SSO (Single Sign-On) for users of my app, but I don't understand how to apply it to my case.
To summarize, we have:
a database
a website
an iPhone app / an Android App
Currently, it's possible to create an account on the site, and then use the same credentials to connect from the mobile apps. All communications between mobile apps and server work through http requests.
To put it simply, I would firstly
be able to use Google accounts to authenticate users
offering Android users to choose one of Google accounts associated with their smartphone
I found several sources of information:
Google - Using OAuth 2.0 for Login
Android - Remembering Users
Unlike what I saw in some examples, I don't need to make request to Google services like Google Calendar or Tasks, I just want to authenticate the user.
Does someone could tell me what I need to do on the website and on the mobile app. Should I store information in my database? How to ensure that after authentication, all http requests from the mobile application are really from authenticated user?
Do not hesitate to ask me to clarify some points.
Thanks in advance
As OAuth is a standard for authorization and not for authentication, it doesn't support any direct method for this. However, most providers allow you to call an endpoint that returns the id of the logged in user. Google returns the id as part of the basic profile information. This step is described in the first article you already mentioned. There are multiple libraries available to simplify this step for you.
So for identifying a user you acquire his Google user id and store/match it in your database.
To get the user's id on an Android device, there's an even more simple way. Just use Google Play Services as described in its documentation. You can find the user id in the response to the call in the last section of the documentation.
Now there's still the problem that you have to send the user id from the device to your web server and verify that this call was issued by your app. Fortunately, Google has also built a method into Google Play Services for exactly this scenario. There's a blog post by Tim Bray at the Android Developers Blog about this.

Register/Login user using their Google Account?

I want my users to login with their Google accounts.
SwiftKey and Catch Notes do it by opening a WebView in their apps. I don't want to do that. I want to use AccountManager.
Tasks Free from Team Tasks uses it and loads your Google tasks easily. The official Google Reader app also uses it and loads your Google Reader feeds.
But I don't want to get any data of the user from Google except their name, email, etc. I only want to register the user and log them back in easily.
How do I register them with OAuth tokens etc?
All the examples I have found either use WebView or only load data from Google (not register).
When I first asked this question, it was really really hard to do. You had to use the Google Java API definitely not built for Android.
But there is now Google Play Services and this task is very easy to do.
Anyone can follow the below links:
https://developers.google.com/+/mobile/android/sign-in
https://developer.android.com/google/play-services/index.html
Google I/O 2011 covered Android + App Engine, which uses Google accounts for authentication. The Android client uses AccountManager. Here's the screenshot.
You may want to look at AccountsActivity in the source code.

Categories

Resources