0

I have developed a login system that once the user register, it sends an email to the user with an "email authentication token". Is there a way to send the link on the email, so once the user clicks on it, it opens the app passing the authentication token instead of opening a web address? So the user can authenticate the email using the app it self, the app will do the call on background to the server and authenticate the user email address, and then send the user to the login activity?

Gil Beyruth
  • 598
  • 1
  • 6
  • 11

1 Answers1

2

First, you will need to do your own schema in your linking Activity

Example

appName://authuser?authentications="value"

<activity android:name=".MyDeepLinkingActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="appName" android:host="authuser" />
    </intent-filter>
</activity>

And then in the Activity you can use this code to get the Data in the uri

Intent intent = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
  Uri uri = intent.getData();
  String valueOne = uri.getQueryParameter("authentications");
}

Edit

I Found that The Gmail has A URI Schema Protections, so the best option to make a request to your website and redirect it to your Custom Schema

Ahmed Mahmoud
  • 111
  • 1
  • 7
  • When you say appName: should I use reverse domain too? com.exemple.appName or just the App Name? – Gil Beyruth Dec 19 '16 at 23:01
  • 1
    It's your custom Schema you can name it anything – Ahmed Mahmoud Dec 19 '16 at 23:03
  • When adding the tag on the email, its not showing a link when I opening the email on Android Gmail app, is there a different way to set the link on the html? `Android` I also sending it to my server and the link works: `Web` – Gil Beyruth Dec 21 '16 at 18:49
  • I Found that The Gmail has A URI Schema Protections, so the best option to make a request to your website and redirect it to your Custom Schema – Ahmed Mahmoud Dec 24 '16 at 14:01