'Twitch login | Swift

i need to implement the Twitch login in swift app with implicit-grant-flow

I think i should use this Authenticating a User Through a Web Service from apple for use a web authentication session to authenticate a user in my app (in this case Twitch login page).

I do not understand how can i catch the token after the login "Your app’s registered redirect URI. The access token is sent to this URI." , in my case i should set http://localhost ?



Solution 1:[1]

Since Twitch doesn't support "device URLS" of the form myapp://

You should utilise a middle man server/webpage

  1. Use the iOS function to open the URL to your middle man page
  2. Middle man page redirects to Twitch
  3. User accepts/declines the Connection
  4. User comes back to your middle man page
  5. Middle man page redirects to myapp://auth/success?token=woo or myapp://auth/failed?error=whate

This is on possible solution. And works for both kinds of oAuth (not that you'd generally use code flow here)

You could run an accounts system and then link Twitch to the account and then your app just logins into the accounts system and can use the linked Twitch Account.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Barry Carlyon