[GH-ISSUE #331] A suggestion #206

Closed
opened 2026-03-03 16:46:40 +03:00 by kerem · 2 comments
Owner

Originally created by @nawar on GitHub (Jan 12, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/331

Description:

Change the user agent to that of Safari to bypass Google's check on browser

OAuth Provider

Google

I'm just wondering why you are not enforcing the User-Agent to be that of Safari's to avoid having the final load request, after the login, to be redirected to the heroku app, and instead, intercept it using shouldStartLoadWith:request:navigationType of UIWebViewDelegate ?

Originally created by @nawar on GitHub (Jan 12, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/331 ### Description: Change the user agent to that of Safari to bypass Google's check on browser ### OAuth Provider Google I'm just wondering why you are not enforcing the `User-Agent` to be that of Safari's to avoid having the final load request, after the login, to be redirected to the heroku app, and instead, intercept it using `shouldStartLoadWith:request:navigationType` of `UIWebViewDelegate` ?
kerem closed this issue 2026-03-03 16:46:41 +03:00
Author
Owner

@phimage commented on GitHub (Jan 16, 2017):

I don"t understand very well your suggestion

First the choice of authorizeURLHandleris yours and could be a SFSafariViewController, a uiwebview, a wkwebview etc...
I think User Agent is also your choice, not OAuthSwift choice

demo app use UIWebViewDelegate and implement shouldStartLoadWith:request:navigationType
like I do in OSX code demo , yes you can intercept request to avoid URL scheme redirection method
there is a wiki page to explain that https://github.com/OAuthSwift/OAuthSwift/wiki/API-with-only-HTTP-scheme-into-callback-URL
this is demo app so it's not the main framework

<!-- gh-comment-id:272848792 --> @phimage commented on GitHub (Jan 16, 2017): I don"t understand very well your suggestion First the choice of `authorizeURLHandler`is yours and could be a `SFSafariViewController`, a uiwebview, a wkwebview etc... I think User Agent is also your choice, not OAuthSwift choice demo app use `UIWebViewDelegate` and implement `shouldStartLoadWith:request:navigationType` like I do in OSX code demo , yes you can intercept request to avoid URL scheme redirection method there is a wiki page to explain that https://github.com/OAuthSwift/OAuthSwift/wiki/API-with-only-HTTP-scheme-into-callback-URL this is demo app so it's not the main framework
Author
Owner

@nawar commented on GitHub (Jan 16, 2017):

No worries. All that I was trying to say is, because how Google only accepts authentication requests coming from a browser, not a web view embedded within the app (I didn't try using WKWebView though), I feel that the web page redirection solution is not optimal. That's the reason I suggested to enforcing the UserAgent as it'll keep the authentication process within the app itself, without the need to spin-off a server just for that redirection.

I'll just close this.

<!-- gh-comment-id:272862322 --> @nawar commented on GitHub (Jan 16, 2017): No worries. All that I was trying to say is, because how Google only accepts authentication requests coming from a browser, not a web view embedded within the app (I didn't try using WKWebView though), I feel that the web page redirection solution is not optimal. That's the reason I suggested to enforcing the UserAgent as it'll keep the authentication process within the app itself, without the need to spin-off a server just for that redirection. I'll just close this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#206
No description provided.