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

The Current Session is Not Open Error #118

Open
akkshay opened this issue Jan 3, 2016 · 3 comments
Open

The Current Session is Not Open Error #118

akkshay opened this issue Jan 3, 2016 · 3 comments

Comments

@akkshay
Copy link

akkshay commented Jan 3, 2016

In my ViewDidLoad, I have the following code:

Venmo.sharedInstance().requestPermissions([VENPermissionMakePayments, VENPermissionAccessProfile], withCompletionHandler: {(success: Bool, error: NSError!) -> Void in
        if success {
            print("working")
        } else {
            print("not working")
        }

when the view is loaded, i am taken to the venmo app, and I press allow, and then im redirected back to my app. In my app, I then press a button that executes the following code:

Venmo.sharedInstance().sendPaymentTo("TestingNum", amount: 1, note: "Testing", completionHandler: {(transaction: VENTransaction!, success: Bool, error: NSError!) -> Void in
if error != nil {
print(error)
} else {
print("no error")
}
})

Once the button, is pressed, I get this error:

Error Domain=com.venmo.VenmoSDK.ErrorDomain Code=7 "The current session is not open." UserInfo={NSLocalizedDescription=The current session is not open., NSLocalizedRecoverySuggestion=If the session is closed, call requestPermissions:withCompletionHandler: to open a new session}
Error Domain=com.venmo.VENCore.ErrorDomain.VENCore Code=1 "No access token" UserInfo={NSLocalizedDescription=No access token, NSLocalizedRecoverySuggestion=Set the default core's access token.}

How can I fix this? When I tried setting the defaultCore's accessToken, it worked, but in order to do that, I had to get the access token from my account on venmo's developer page and copy and paste it in my xcode project. That venmo token expires every 30 minutes, so how can I write code so that I get the access token from my app and don't have to go into Venmo's developer site and press "get token" every time?

@eliperkins
Copy link

Are you calling [Venmo startWithAppId:@"VENMO_APP_ID" secret:@"VENMO_APP_SECRET" name:@"VENMO_APP_NAME"]; anywhere? In order to be able to authenticate new users, we need a way to associate the app that is requesting the access token on their behalf.

@akkshay
Copy link
Author

akkshay commented Jan 4, 2016

Yes, I'm calling that in my App Delegate didFinishLaunchingWithOptions. Should I be calling it right before the sendPaymentTo function in my viewcontroller?

@akkshay
Copy link
Author

akkshay commented Jan 5, 2016

I tried calling that method in my view controller right after the pay button is pressed and before the request permission and sendPaymenTo methods are called. Still got the same errors (error code 7 & error code 1)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants