tufanv Expert Licensed User Longtime User Dec 27, 2018 #1 Hello, Following this tutorial : https://www.b4x.com/android/forum/threads/google-play-developer-api.81839/#content on stackoverflow, someone wrote : "The access_token expires after one hour of exchange you so need some server code to handle this and Google have provided several libraries in many languages to handle this (list not exhaustive):" My question is : should we run the server app described in Erel's tutorial on a vps so that token is updated every hour ? because I need to check users inventory on every user logon to my app ? Thanks
Hello, Following this tutorial : https://www.b4x.com/android/forum/threads/google-play-developer-api.81839/#content on stackoverflow, someone wrote : "The access_token expires after one hour of exchange you so need some server code to handle this and Google have provided several libraries in many languages to handle this (list not exhaustive):" My question is : should we run the server app described in Erel's tutorial on a vps so that token is updated every hour ? because I need to check users inventory on every user logon to my app ? Thanks
DonManfred Expert Licensed User Longtime User Dec 27, 2018 #2 tufanv said: on a vps Click to expand... yes. As it uses the OAuth2 Class i expect it to work on a VPS. Means the Serverapp should be able to refresh the token if needed. Upvote 0
tufanv said: on a vps Click to expand... yes. As it uses the OAuth2 Class i expect it to work on a VPS. Means the Serverapp should be able to refresh the token if needed.
DonManfred Expert Licensed User Longtime User Dec 27, 2018 #3 Make sure to use the newest OAuth2 Class (use the bas file provided; not the one inside the Example ZIPs) as it works with B4J now. Upvote 0
Make sure to use the newest OAuth2 Class (use the bas file provided; not the one inside the Example ZIPs) as it works with B4J now.
tufanv Expert Licensed User Longtime User Dec 27, 2018 #4 I have now changed the parameters on both server and client apps and it seems to work. But the server was local. What confuses me is if I upload this jar to my vps , will I need to leave it running or will I have to run it every 30 minutes for example to update the token ? second one seems more reasonable to me. Also where will i instruct my b4a app to interact with the server , or don't I need to interact with the server again ? So confusing for just to validate some inapp purchases. Upvote 0
I have now changed the parameters on both server and client apps and it seems to work. But the server was local. What confuses me is if I upload this jar to my vps , will I need to leave it running or will I have to run it every 30 minutes for example to update the token ? second one seems more reasonable to me. Also where will i instruct my b4a app to interact with the server , or don't I need to interact with the server again ? So confusing for just to validate some inapp purchases.
DonManfred Expert Licensed User Longtime User Dec 27, 2018 #5 1. You always should create a new thread for a new Question. 2. It is a server app which is expected to run all the time to be able to answer client-requests. 3. As it is using the OAuth-Class it should be able to get a Token (even if the token is expired and a client connect to the server, the server then want to use the Token. If the token is expired then the OAuth Class will get a new one based on the refresh-token stored. B4X: Expand Collapse Copy oauth2.GetAccessToken Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String) If Success = False Then Log("Error accessing account.") Return End If ' use the token here .... I can´t answer any question about InApp-Purchases in detail; i do not have any single app using InAppPurshase. Upvote 0
1. You always should create a new thread for a new Question. 2. It is a server app which is expected to run all the time to be able to answer client-requests. 3. As it is using the OAuth-Class it should be able to get a Token (even if the token is expired and a client connect to the server, the server then want to use the Token. If the token is expired then the OAuth Class will get a new one based on the refresh-token stored. B4X: Expand Collapse Copy oauth2.GetAccessToken Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String) If Success = False Then Log("Error accessing account.") Return End If ' use the token here .... I can´t answer any question about InApp-Purchases in detail; i do not have any single app using InAppPurshase.
DonManfred Expert Licensed User Longtime User Dec 27, 2018 #6 DonManfred said: If the token is expired then the OAuth Class will get a new one based on the refresh-token stored. Click to expand... from OAuth-Class B4X: Expand Collapse Copy Public Sub GetAccessToken If ti.Valid = False Then Authenticate Else if ti.AccessExpiry > DateTime.Now Then GetTokenFromRefresh Else RaiseEvent(True) End If End Sub Upvote 0
DonManfred said: If the token is expired then the OAuth Class will get a new one based on the refresh-token stored. Click to expand... from OAuth-Class B4X: Expand Collapse Copy Public Sub GetAccessToken If ti.Valid = False Then Authenticate Else if ti.AccessExpiry > DateTime.Now Then GetTokenFromRefresh Else RaiseEvent(True) End If End Sub