Question: I'm developing a simple app for Android TV using Flutter.

I would like to add authenticated users.

Android TV would display something like:

To login go to [www.domain.com/activate](http://www.domain.com/activate) on any device and enter this code: ABC123XYZ

Once logged in on a phone or computer and the code is entered Android TV app is authenticated and ready for future use.

Just wondering how is this implemented, any help is appreciated.

Answer: 
Multiple-way you can perform this

1. Websocket
2. API services

First let's check for API Web Services, create a page for Android TV users and send the code they have entered from remote to the server let the user do the computation and get back that user is authenticated.
Although I personally do not like this feature as typing on tv is rather a bad user experience with the remote keypad.

Let's go with the WebSocket, create a QR code with UUID information on tv, connect tv app with WebSocket to receive authentication updates, then scan QR code via a mobile app the code that you have generated on tv is UUID of that tv and you got unique token after scanning, now send this UUID to the server and server will fire socket message to the TV that you have been authenticated.

also, it would be best if you go to your backend developer regarding this query is regarding flow and that can be determined by any backend engineer.
I would suggest implementing

<https://oauth.net/2/grant-types/device-code/>

Your app would periodically poll the server asking if authenticated

once the user has gone to said website and put in said code, the next poll you would return a token etc. for the app to use and then let your app do its thing.