Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFSafariViewController not implemented #46

Closed
kabiroberai opened this issue Sep 13, 2015 · 17 comments
Closed

SFSafariViewController not implemented #46

kabiroberai opened this issue Sep 13, 2015 · 17 comments

Comments

@kabiroberai
Copy link

I'm not too sure where to ask this (GitHub repositories don't really have feature request pages), but is it possible to add SFSafariViewController to this framework? Now that we can submit iOS 9 apps, I'm sure that it would be a much better user experience.

@p2 p2 added the enhancement label Sep 14, 2015
@p2
Copy link
Owner

p2 commented Sep 14, 2015

You're in the right spot for "feature requests", I'm flagging this as an enhancement.

@HerbstLukas
Copy link

This would be so awesome! :) +1

@nickvelloff
Copy link

👍 💥 🙌

@p2 p2 closed this as completed in 7558c7b Sep 17, 2015
@p2
Copy link
Owner

p2 commented Sep 17, 2015

Implemented on the master branch; iOS 9 will now automatically use SFSafariViewController when using embedded authorization. Let me know how this works for you!

@kabiroberai
Copy link
Author

@p2 thanks! I'm having one problem though, I updated the repository, but for some reason calling authorise() now gives me a blank white view. Here is the code I'm using -
oauth2 = OAuth2ImplicitGrant(settings: settings)
oauth2.blog = currLogbook
oauth2.authConfig.authorizeEmbedded = true
oauth2.authConfig.authorizeContext = self
oauth2.onAuthorize = {params in
self.getPosts()
}
oauth2.authorize(params: ["blog":currLogbook], autoDismiss: true)

@p2
Copy link
Owner

p2 commented Sep 17, 2015

Is this from inside a UIViewController? What is oauth2.blog?

I should also mention that now one needs to intercept the callback in the app delegate, see here:
https://github.com/p2/OAuth2#3-authorize-the-user

@kabiroberai
Copy link
Author

@p2 blog is an extra parameter I wanted to pass (I'm using wordpress authentication)

@kabiroberai
Copy link
Author

Also, the UIViewController is a modally presented viewcontroller with a navigation controller as its parent

@p2
Copy link
Owner

p2 commented Sep 17, 2015

Does it work correctly if you set oauth2.authConfig.ui.useSafariView = false?

@kabiroberai
Copy link
Author

@p2 yeah, it does. Btw I was using the OS browser before so i have already implemented openURL

@p2
Copy link
Owner

p2 commented Sep 17, 2015

You need to be more specific. Does it now show the old built-in web view? Is there an error logging when using the Safari view? What can you see when you use Xcode's view debugging? Goes the view blank just like that or is a white view presented? ...

@kabiroberai
Copy link
Author

@p2 It shows a completely white screen, throwing absolutely no errors. Also, although the view is a master split screen view controller, even on the iPad it shows in fullscreen mode.

@kabiroberai
Copy link
Author

@p2 wait... so it doesn't seem to be OAuth2's fault, I even tried loading a regular SFSafariViewController and it showed up blank

@p2
Copy link
Owner

p2 commented Sep 17, 2015

Hmmm interesting. SFSafariWebView works on my Xcode GM install, I'm not sure what could cause this.

Yeah the fullscreen thing might be something that not everybody wants, certainly not on iPad.

@kabiroberai
Copy link
Author

@p2 it could be because of the UISplitViewController I suppose

@kabiroberai
Copy link
Author

@p2 I figured it out. Apparently SFSafariViewController (or any view controller actually) does not like to be presented before the view appears. I was attempting to do it in viewDidLoad, but when it is called, I don't think the view is in the hierarchy yet.

@p2
Copy link
Owner

p2 commented Sep 17, 2015

Yes, use the appear methods for that.

suneth added a commit to m2d2/OAuth2 that referenced this issue Oct 15, 2015
…-onepassword

# By Pascal Pfiffner (60) and others
# Via Pascal Pfiffner
* 'master' of https://github.com/p2/OAuth2: (73 commits)
  Update docs generator
  Update SwiftKeychain submodule
  Update to 2.0.1
  Remove println() in README for Swift 2.
  Use SFSafariViewController, fixes p2#46
  Nicer state handling
  Update podspec to 2.0.0
  Fix documentation keywords
  Update to 1.2.9
  Add only-if-needed to DynReg method
  Documentation update
  Update readme
  Bump version to 1.2.8
  Update for Xcode 7 beta 6.
  Swift 2.0 update
  Fix README
  Allow to customize back-button (fixes p2#40)
  Also check HTTP status
  Updated to do failure conditions the better way within the library, thanks!
  Oops, I always used the positive case for password, not the negative. Fix OAuth Password grant to check if token is granted by server.
  ...

Conflicts:
	OAuth2/OAuth2CodeGrant.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants