mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #442] Coub doesn't work #286
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#286
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gerchicov-bp on GitHub (Mar 5, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/442
Description:
OAuth Provider (Twitter, Github, ..):
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
9.0 (Swift 4.0)
9.0 (Swift 3.2)
8.x (Swift 3.x)
8.0 (Swift 2.3)
7.3.1
other: (Please fill in the version you are using.)
objective c
my code:
In app delegate:
The app goes in background and Safari appears. Tried to login into safari - no effect
@phimage commented on GitHub (Mar 5, 2018):
let oauthswiftis wrongset as class attribute to retain it in memory
Then maybe you doesn't understand the purpose of redirect url and url scheme
Why "http://gargo.of.by" ? This url does not redirect to your app, so why app delegate code must be called?
You must have an url scheme see readme, and the url must be like myappnamescheme://oauth-callback for instance
@gerchicov-bp commented on GitHub (Mar 5, 2018):
@phimage coub has a webpage with option "Callback URL". How to fill it and specify URL scheme?
Note it seems it applies only http/https schemes
@phimage commented on GitHub (Mar 5, 2018):
https://github.com/OAuthSwift/OAuthSwift/wiki/API-with-only-HTTP-scheme-into-callback-URL
@gerchicov-bp commented on GitHub (Mar 5, 2018):
@phimage sorry but I still don't understand:
It still doesn't return to the app.
Callback URL is set to "http://testcoub2.com/auth/callback" in coub settings.
If I try to use in code "testcoub2://auth/callback" - it writes that redirect url is incorrect (doesn't equal to the one set in settings).
If I try to set "testcoub2://auth/callback" in coub settings - it writes that this url is invalid.
Also tried to modify code in your examples... It works with option "Open with internal web view controller"! So as I understand the code is correct but something wrong with app/library/url scheme.
But in the same time
successandfailureblocks are not called@phimage commented on GitHub (Mar 6, 2018):
http://testcoub2.com/auth/callback
is not testcoub2://auth/callback
http://testcoub2.com/auth/callback doesn't exist
please read more carefully readme and now the wiki page.
You must have an http server which redirect to your app by redirecting to testcoub2://auth/callback
Or you must use internal web view to handle redirection (but apple do not like that), I did not try with safari controller yet
@gerchicov-bp commented on GitHub (Mar 6, 2018):
@phimage ok I understood that:
1)coub doesn't allow custom redirect url schemes
2)anyways I could use inner web browser
The one thing I still can't understand -
successandfailureblocks are not called. Anyways something is still incorrect with them - they should be called or if they are not necessary then there should beauthorizemethod without these params (or success block should be marked as optional)@phimage commented on GitHub (Mar 6, 2018):
success or failure block are called if
OAuthSwift.handle(url: url)is calledaccording to the url query parameters
if you never call that method, there is no end, now way to known if authentification is success or failure
@gerchicov-bp commented on GitHub (Mar 6, 2018):
@phimage Ok it seems I have found a mistake in your own code. Compare implementation for iOS:
and OSX:
It seems these methods perform the same work but in OSX you call
AppDelegate.sharedInstance.applicationHandle(url: url)but not in iOS. So in your examplesuccessandfailureblocks will have never been called.Additionally:
applicationHandleOpenURLmethod doesn't exist.@phimage commented on GitHub (Mar 6, 2018):
do you know that swift has been updated, so the signature change? this is a just a comment so no refactor...
and no there is no issue in code
just no implementation in demo app for iOS using the delegate, normal callback url is used using demo url scheme