Redirecting to my app after I have logged in from Twitch andorid app

Hi,

I am creating an android app where I am using twitch to login a user. When I don’t have twitch app installed I am opening a web view to load the URL for user to give permission. And if the user gives permission I am redirected to a URL with access token.

But when I have twitch app installed in my device I am opening the twitch app to login the user but after the user successfully logs in I want to be able to go back to my app and receive the access token. How can I achieve that?

Thanks

You should be able to open your application with some metadata by using a custom protocol handler (such as my-android-app://some-url). See the Android docs for app links.

In practice this means you’ll have a return url such as my-android-app://callback/?token=<TOKEN>. As you’ll have set up your app to handle the my-android-app protocol it should automatically be opened. You can then get the token from the URI.

So are you saying that this URL `my-android-app://callback/?token= will be opened when I successfully give permission from twitch android app? And then I can use deep linking to open a specific activity in my own app?

Yes - I the past OAuth apps I’ve been using I was able to specify a custom callback URL, and that can indeed by a deeplink.

I am using this guide for opening Twitch app and then open the login screen

But when the user successfully logs in the permissions screen doesn’t open.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.