Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift / Instagram API - how to auth with Instagram App

I need an AccessToken to have the User have granted access to his own Instagram Account within my App. I've registered everything within the Instagram Development Center.

Currently I'm using SimpleAuth to receive an AccessToken by Instagram.

So far everything is working well. I'm receiving the Token and am able to use it.

But when I wanted to login for the first time, I've noticed, that I had no idea what my password was. I always log in with Facebook or am already logged in. I don't want to have my users face the same issues and have them reset their Instagram password...

I have googled for a while now, without success. Is there a way to authenticate the User and receive an AccessToken using the Instagram App?

I already have added instagram to the LSApplicationQueriesSchemes at the info.plist and sending images to the Instagram App to post them there is working. So calling the app itself is not the issue.

This is my current code that opens a WebView within a UIViewController - but the User has to login with username and password.

enter image description here

Update to the code for: how to auth with Instagram

What are my possibilities? Help is very appreciated.

like image 247
David Seek Avatar asked Sep 28 '16 23:09

David Seek


People also ask

How do I integrate Instagram with Swift?

Index> = requestURLString. range(of: "#access_token=")! var request = URLRequest(url: URL(string: url)!) Hope it will help in Integration of Instagram social login in app.

Can you login with Instagram API?

Authentication — Instagram Basic Display is not an authentication solution. Data returned by the API cannot be used to authenticate your app users or log them into your app. If you need an authentication solution we recommend using Facebook Login instead.


1 Answers

No, you cannot use Instagram app to authenticate Instagram account at the moment.

However, web view seems to be a reasonable way to login especially in iOS 9 and above because it does not require user to switch between apps and having to tap on dialogs to switch app. The only pain is for the user to type username and password, but hopefully they only need to do that once (unless they change account).

Facebook has similar issue and choose to go with web view login as default way to authenticate.

For the people who are not signed into Facebook on Safari, they will only need to log into Facebook one time. After that, every future Facebook Login experience is fast and convenient with no extra steps. This means that as adoption of this flow increases over time, so does the quality of the experience people get. In contrast, the traditional fast-app-switch flow does not improve over time: The additional dialogs continue to appear in both directions for every new app that people log into.

https://developers.facebook.com/blog/post/2015/10/29/Facebook-Login-iOS9/

like image 181
ramacode Avatar answered Sep 28 '22 05:09

ramacode