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

receivedValidAccessTokenFromURL doesn't seem to work in swift #256

Open
MaikoHermans opened this issue Sep 26, 2016 · 3 comments
Open

receivedValidAccessTokenFromURL doesn't seem to work in swift #256

MaikoHermans opened this issue Sep 26, 2016 · 3 comments

Comments

@MaikoHermans
Copy link

I'm currently trying to authorize instagram by using the InstagramKit library.
Currently I'm working with swift 3.0 the code looks as follows (for testing purposes)

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        engine = InstagramEngine.shared();
        let iScope: InstagramKitLoginScope = [.comments, .followerList, .likes, .relationships];

        let iAuthURL = engine.authorizationURL(for: iScope);

        loginWebView.loadRequest(URLRequest(url: iAuthURL));
        loginWebView.delegate = self;
    }

    func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
        let url = request.url;
        try! engine.receivedValidAccessToken(from: url!)

        return true;
    }

I've set the following in my info.plist

InstagramAppClientId:             'myid'
InstagramAppRedirectURL:     'http://example.com'

When I put a debug on the request.url. This shows me the following

https://api.instagram.com/oauth/authorize/?client_id=myid&redirect_uri=http%3A//example.com&response_type=token&scope=comments%20relationships%20likes%20follower_list

Looking at it I'm wondering if it goes wrong at the http%3A?
I hope someone knows what is happening and how to fix it

@ToxaZhe
Copy link

ToxaZhe commented Oct 6, 2016

I have the same error don't know what is the problem

@MaikoHermans
Copy link
Author

I have fixed it.
Take a look at my stack overflow question here.
Just scroll the the bottom where I answered my own question.

@ToxaZhe
Copy link

ToxaZhe commented Oct 6, 2016

thanks))

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

2 participants