In-App Authentication
In order to support payment via the InPlayer system, the native application should have an authentication functionality in place that authenticates a user in the InPlayer system. This can be implemented easily by using our register and login methods, provided in the native SDKs. These methods have the end-user successfully logged in/registered in the InPlayer system and return an authentication token to the application. Once these methods have the end-user authenticated, the application can offer them the payment options.
The signUp method for iOS:
The authenticate method for iOS:
The signUp method for Android:
The authenticate method for Android:
https://inplayer-org.github.io/inplayer-android-sdk/
#
Social AuthThere is also the possibility of having your end-users authenticated via implementing the Social Auth feature which enables them to log in/register to your app by using their social platforms' accounts. Once they are authenticated, they can proceed to purchasing your in-app offer(s).
#
Social Auth SetupTo enable (or disable) the social logins of your choice, you need to click on their 'Setup' toggle buttons. Once they are enabled, you will find the social login buttons displayed on the Paywall.
For further clarification regarding the Social Auth, please refer to the following article: https://client.support.inplayer.com/settings/social-login/.
#
SDK Methods for iOSOur SDKs facilitate you to enable login via social platforms. In order to do so, take note of the example below.
Example
First, you should edit your plist file with your URL Scheme by adding the following lines:
Second, in the controller where you want to introduce the social login, you can call the method getSocialUrls
with the same URL Scheme you have inserted in your plist file:
The response returns a list of social login options that you can choose from (Facebook, Twitter, Google etc).
After clicking on one of them call the socialLogin
method:
This will open the social url in an external browser where you can log in with your credentials. After successful login, a pop-up will appear asking you whether you want to open your application. Responding with 'Yes' will take you back to your app where you will either get the account details or a possible error message.
To ensure everything mentioned above works, proceed to your AppDelegate to find the following method:
Then edit this method by inserting the following line of code:
This line will intercept the token after successful login.
#
SDK Methods for AndroidExample
First, you should edit your AndroidManifest.xml file with your URL Scheme by adding the following lines into your plist file:
Second, inside your Activity or Fragment, you should search for a list of all the available Social Urls. Once found, you should use the same URI Scheme you have configured in the previous step. To encourage best practices, we suggest that you use the package name. You can configure it on your own, but make sure it is a unique one. Beware not to forget placing the '://' at the end, though this suffix should not be included when defining the scheme in the manifest. This can be done with the following method:
The response returns a list of social login options that you can choose from (Facebook, Twitter, Google etc). Each of the social login options will consist of two string values - socialAuthName
and socialAuthUrl
.
After selecting the wanted SocialLogin
method, open a web browser using Intent.ACTION_VIEW
:
As a result, taking this action will open the social url into an external browser where you can log in with your credentials. After successful login, you would be redirected to your app.
Lastly, to validate the received token, there is one last step to execute. In other words, you need to override the onResume()
method inside the Manifest's Activity that you have already defined with the data scheme. The Intent.data
should contain a URI for validation which should be sent to InPlayer.Account.validateSocialLoginToken(uri,callback)
method like in the example below:
Congratulations!
You have successfully authenticated using SocialUrls.
For a more detailed example, you can check the Example code inside LoginActivity.kt
.