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

Fail to authorise #339

Open
jmgawecki opened this issue Jan 9, 2021 · 2 comments
Open

Fail to authorise #339

jmgawecki opened this issue Jan 9, 2021 · 2 comments

Comments

@jmgawecki
Copy link

jmgawecki commented Jan 9, 2021

Hey guys. I gotta say I am very new to this, its the first time I am using any library in my projects.
I fail to authorise my calls.

In my info.plist I've changed that to my API key as instructed (did I do it right tho?)
Screenshot 2021-01-09 at 20 34 51

Then in one of my viewDidLoad I wrote that line of code

var swifter = Swifter(consumerKey: "MYAPIKEY", consumerSecret: "MYSECRETAPIKEY")
swifter.authorizeSSO { (token) in
print("tralala")
} failure: { (error) in
print(error)
}

It does prints the error out:

2021-01-09 20:14:40.755134+0000 TwitterApp[46860:4745944] [default] Failed to open URL
twitterauth://authorize?consumer_key=MYAPIKEY&
consumer_secret=MYAPISECRETKEY&oauth_callback=swifter-HARhDi2A9ZCrRpBW6cr27PQRZ1LNHiog7HjHpc992XGb3a0BpJ:
Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)"
UserInfo={_LSLine=229, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}
SwifterError(message: "Cannot open twitter app", kind: noTwitterApp)

I also fail to understand in what moment I should use my Bearer Token. I am sure I am doing something wrong and it would be amazing if anyone could help me with that! :)

Also readMe file says to use swifter.authorize(with: callbackURL, success: { accessToken, response... but I can't see such a member.

The members I have are:
Screenshot 2021-01-09 at 20 25 26

Many thank for your time mates.

@jmgawecki
Copy link
Author

Hey. I think I did a little progress in order to understand what is going on yet it still does not work.

I tried something like this. APIConsumerKeys are Strings with my consumerKeys and Tokens.
Uploading Screenshot 2021-01-11 at 02.00.43.png…
I am getting that error
TwitterApp[8314:561123] [default] Failed to open URL twitterauth://authorize?
consumer_key=kMYKEYd&consumer_secret=IMYSECRETKEYa
w3VyWUsolyug4tJX&oauth_callback=swifter-kj9BnIgesy2I7gdgydBneM7ud: Error
Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=229, _LSFunction=-
[_LSDOpenClient openURL:options:completionHandler:]}

I will keep digging in but I will likely fail to understand. Any help would be very appreciated:))

@jmgawecki
Copy link
Author

Hi again.
I have successfully managed to set the library and it is on!

I know its a very beginner question but here it is. I don't know what to do with that object JSON, perhaps from swifter.searchUser. It returns array of [JSON] but lets say I already put it into variable JSON. Is there any build in function in Swifter to reach members of that object like createdAt or iD so I can use it in my project? Thank you!

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

No branches or pull requests

1 participant