最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Issue with Redirecting Back to App After Logout using OAuth - Stack Overflow

programmeradmin0浏览0评论

I'm currently using an OAuth library for handling login and logout in my app, and the login flow works fine. Safari opens for authentication and successfully redirects users back to my app once they log in.

However, I'm facing an issue during the logout process. When the user clicks logout, Safari opens the URL to perform the logout mechanism, but once it's complete, the user cannot return to the app. The redirection back to the app doesn't occur as expected, even though I have confirmed that the post_redirect_uri is correctly configured and matches the one used during login.

I'm currently using an OAuth library for handling login and logout in my app, and the login flow works fine. Safari opens for authentication and successfully redirects users back to my app once they log in.

However, I'm facing an issue during the logout process. When the user clicks logout, Safari opens the URL to perform the logout mechanism, but once it's complete, the user cannot return to the app. The redirection back to the app doesn't occur as expected, even though I have confirmed that the post_redirect_uri is correctly configured and matches the one used during login.

Share Improve this question asked Feb 6 at 5:11 Rushabh ShahRushabh Shah 3983 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I would recommend using the Apple component ASWebAuthenticationSession ( See https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession ). It basically presents, within your app, a Safari view controller-like which is acting like the SFSafariViewController and it is isolated from the rest of the app. The main difference is that it will automatically close if a certain URL or scheme is triggered within the web page, so theoretically when you would trigger the logout, it could recognize a certain URL scheme for example, and it would automatically close. iOS side it would dismiss and you would get notified via completion handler. You can find examples, eg. at How to get an auth code using ASWebAuthenticationSession?

发布评论

评论列表(0)

  1. 暂无评论