Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Cannot login with [.PublishActions] permissions #3

Closed
boomesh opened this issue Jul 14, 2016 · 7 comments
Closed

Cannot login with [.PublishActions] permissions #3

boomesh opened this issue Jul 14, 2016 · 7 comments
Assignees
Labels
bug Something is broken or being fixed

Comments

@boomesh
Copy link

boomesh commented Jul 14, 2016

Relevant Code

if let accessToken = AccessToken.current {
    print(accessToken)
} else {
    let loginManager = LoginManager()
    let completion = {
        (result:LoginResult) in
        switch result {
        case .Success(let grantedPermissions, let declinedPermissions, let accessToken):
            print("YES! \n--- GRANTED PERMISSIONS ---\n\(grantedPermissions) \n--- DECLINED PERMISSIONS ---\n\(declinedPermissions) \n--- ACCESS TOKEN ---\n\(accessToken)")
        case .Failed(let error):
            print("No...\(error)")
        case .Cancelled: 
            print("Fine.")
        }
    }
    loginManager.logIn([.PublishActions], viewController: self, completion: completion)
}

I'm not sure if this is intentional, but in LoginManager.swift

public func logIn(permissions: [PublishPermission] = [.PublishActions],
                  viewController: UIViewController? = nil,
                  completion: ((LoginResult) -> Void)? = nil) {
  let sdkPermissions = permissions.map({ $0.permissionValue.name })
  sdkManager.logInWithReadPermissions(sdkPermissions,
                                      fromViewController: viewController,
                                      handler: LoginManager.sdkCompletionFor(completion))
}

When I'm trying to login with publish permissions, it's wrapping around a logInWithReadPermissions method. Is this intentional? When logging in with that permission, I get the following exception:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Publish or manage permissions are not permitted to be requested with read permissions.'
@nlutsenko
Copy link
Contributor

Not intentional, indeed a valid bug.
Thank you for flagging this!
I am on it!

@nlutsenko nlutsenko self-assigned this Jul 14, 2016
@nlutsenko nlutsenko added the bug Something is broken or being fixed label Jul 14, 2016
@nlutsenko
Copy link
Contributor

@boomesh, thank you for flagging this.
Should be resolved with attached #4.

@boomesh
Copy link
Author

boomesh commented Jul 14, 2016

@nlutsenko nice! Are there unit/integration tests in this project as well? Or are we just using travis as a "does this compile" kinda check for now?

@nlutsenko
Copy link
Contributor

nlutsenko commented Jul 14, 2016

Frankly, only the latter.
We are in process of adding unit and integration tests to the whole thing, but right now we are at the mercy of we made sure this works manually.

@boomesh
Copy link
Author

boomesh commented Jul 14, 2016

@nlutsenko fair enough. Is there a release schedule somewhere? Or, do you know when 0.1.1 is gonna' be released?

@nlutsenko
Copy link
Contributor

Later today, since this is quite an important issue to fix.

@italoBianchini
Copy link

let permissionsList : [Any] = ["email"]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something is broken or being fixed
Projects
None yet
Development

No branches or pull requests

3 participants