I've just completed a really nice SDK for iOS. A major functionality handled by this SDK is the sign in through OAuth. To let user log in I present an in-app browser (SFViewController) presenting a login page that is hosted on my server... My question is, how can I perform OAuth login using tvOS... if I'm not wrong, I cannot present a webview or open an external browser right?
2 Answers
You are right, there is no web view or external browser on tvOS. If you must use OAuth, follow the ideas in the answer to this SO question: Authentication to dropbox on tvOS - redirect your users to the web or to a companion app, that does the authentication on behalf of the tvOS app.
I would suggest avoiding OAuth for tvOS apps or similar "tv devices" that do not have browsers or where browser input are cumbersome etc.
You can check out the "rendezvous" registration flow. It's detailed on the Roku dev site. Roku is similar to Apple TV. This flow is handy when you have an existing site/user base where authentication must be (and probably already is) supported on many different devices, not only in the apple world.
This overview describes the typical flow and API used for registering and linking a device to an authentication service. The primary and recommended method for linking a device involves 3 main steps:
Display a short on-screen registration code (generated on the server) on the Roku device.
The user links the device by entering the registration code on the provider's website/service.
The service confirms the code is correct and issues a token to the Roku device. Once the device downloads the token, the channel displays a congratulations screen and allows the user access to the video service. The next time the channel is launched, the service will check if the token matches.
This is known as the "rendezvous" style of registration.
https://developer.roku.com/en-gb/docs/developer-program/authentication/authentication-and-linking.md

- 15,955
- 18
- 111
- 232
-
I realize now, after clicking through the link on the accepted answer, that this is in a sense the same answer; albeit the logic behind it is very nicely concisely explained on the Roku site. – Jonny Jul 16 '19 at 01:18