How to handle OAuth authentication for streaming platform in Swift iOS app

I’m working on integrating OAuth authentication for a popular streaming service into my iOS application using Swift. I want to use the implicit grant flow method for this implementation.

My plan is to utilize Apple’s ASWebAuthenticationSession to handle the web-based login process within my app. This should allow users to authenticate through the streaming platform’s login page directly.

The main issue I’m facing is understanding how to properly capture the access token once the authentication is complete. The documentation mentions that the token gets sent to a registered redirect URL, but I’m confused about what URL I should use for this purpose in a mobile app context.

Should I be using a localhost URL for the redirect, or is there a better approach for iOS apps? How do other developers typically handle the token callback in this scenario?

yea, totally go for a custom URL scheme like yourapp://oauth/callback. way easier than localhost. just put it in your info.plist under URL types. ASWebAuthenticationSession will take care of redirecting back to your app after login.