how will google/gtm-oauth2 / GTMOAuth2ViewControllerTouch work in April? - ios

i am using gtm-oauth2 (as part of https://github.com/google/google-api-objectivec-client ) and I started getting a warning about webviews not being supported to sign in on april 2017.
i assume they want me to move to https://developers.google.com/identity/sign-in/ios/ , but I can't find an example how to integrate the sign-in sdk with https://github.com/google/google-api-objectivec-client-for-rest or https://github.com/google/google-api-objectivec-client which seem to still want to handle sign in with GTMOAuth2ViewControllerTouch which as I understand is not acceptable under the new rules
my question: what mix of google sdks allows me to sign in to google the correct way and then access things like google drive apis?

my guess is I should be using https://github.com/google/GTMAppAuth
and not https://developers.google.com/identity/sign-in/ios/

Related

disallowed_useragent with Google Drive SDK

I am trying to implement Google Drive SDK in my project but nothing seems to go well, i wanted to upload images and create folder on Google Drive but i am stuck with the error ,which i don't know how to get through, as i found nothing related to the following error.
I have strongly followed this link for code
Google has updated its security restrictions for OAuth flow. They are not going to allow native web-views to initiate OAuth flows. You will need to use the OS browsers to do so.
Modernizing OAuth interactions in Native Apps for Better Usability and Security
You may have to wait for google to update the sample code or figure out how to do it yourself sorry i am not an IOS developer so cant be of any help.
The issue is already logged on the issue forum for Google drive 4919

Swift 2 OAuth2 LinkedIn connection

I'm gonna make an native iOS app with Swift 2 and Xcode 7. The users should login using LinkedIn and OAuth 2 but I'm wondering how I should begin to set this up. I don't have many experience with OAuth 2.
Is there a good tutorial or a sample app? I saw the Ray Wenderlich post but that comes with an existing project. I want to build an app with LinkedIn login from scratch.
EDIT
I want to use the LinkedIn login to get the user's connections and send them notifications. I was researching this and I found some pages that said that connections can't be retrieved from the new LinkedIn API, is this true? It is not possible to get someone's connections from LinkedIn in a native iOS applications?
You should start with LinkedIn guide for LinkedIn and OAuth 2 .
But still if you need a sample for Authentication with OAuth 2 here it is .
For your second question related to the connection yes Linked have made changes but the API is still available but for the partners .
If you are an existing LinkedIn partner, these changes will not impact your existing partnership or the associated APIs that your partnership allows you to access.
If you are experiencing issues as a result of the May 12th changes, please reach out to your LinkedIn Business Development representative immediately.
For further details you can see Developer Program Transition Guide.
Check out this repo, I did this swift pre-2.0 but it shows you the basic algorithm. You can do it the with your secret hard coded or fetch it from the server. The key is getting the oath header just right which is a huge pain
https://github.com/GregPrice24/SwiftStream
Check this out: https://github.com/jeyben/IOSLinkedInAPI
I used this repo and successfully implement LinkedIn integration in my App. It is in Objective-C but you can use Cocoapods and import them as Frameworks and use in swift2 with no trouble.
Note: As of the 12ยด May 2015 LinkedIn applied restrictions to API usage for all non partners: See: https://developer.linkedin.com/blog/posts/2015/developer-program-changes
So you can only get the basicprofile at the beginning, but you can apply for the partner program to get those extra information such as connections here: https://developer.linkedin.com/partner-programs

Swift iOS Twitter API Fails

I am trying to load some twitter feeds of a user on Swift iOS App. On twitter Documentation, I found the API is:
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2
which returns:
{"errors":[{"message":"Bad Authentication data","code":215}]}
Older Rest API did not require. Newer API requires authentication.
Requires authentication? Yes
How do I get that working? Any tutorials would be even sweeter!
Before marking this question duplicate please bear in mind that I have done a good search and none of the answers answered my questions because a lot them point to older Rest APIs.
Take a look at Twitter Fabric http://dev.twitter.com/fabric which is a free SDK (compatible with Swift) that provides easy authentication via either guest or user login. Sample app written in Swift at https://github.com/twitterdev/cannonball-ios
If you would prefer to use raw REST calls against the API, follow the OAuth details in our dev documentation https://dev.twitter.com/oauth
In settings of your simulator go to accounts -> Twitter, and login there in actual twitter account. As you try to login, it doesn't know what user to use, so you need to specify it.

How to implement "Use one-click single sign-on" correctly in order to publish to Google Apps Marketplace

We already have a web app that integrate with differente Google services. Right now, you can loguin using a Google account, can import a contact lists from any Google account, and can sync a Google Calendar with our Calendar in the webapp (We implemented all of this using OAuth 2 and invoking the GoogleApi with a REST Client).
We are now trying to publish this app in the GoogleApp Marketplace, but we are failing to comply with the "Use one-click single sign-on" rule (https://developers.google.com/apps-marketplace/practices#5_use_one-click_single_sign-on).
We are believing that the problem is we the way we are solving the fact that we need offline access for all the integrated users in the app. Right now, the only way we found to get the refresh tokens for them, was starting the OAuth2 process with the parameters access_type=offline&approval_prompt=force, but this forces them to enter their credentials.
We aren't using the 'Google+ Domains API', and we are starting to believe that we should. Is the use of this API mandatory for complying with the "Use one-click single sign-on" rule?
Thanks,
Well, we finally figured it out. We had to use the Google Admin SDK in order to implement SSO. We had some troubles with the scopes, but after we polished that, everything seems to be working OK.

Is Google Cross-client Auth possible with iOS, and if so, how?

I'm using oAuth2, and I have a project in my google API console with an iOS client and a Web client registered.
I'd like to auth in from my iOS app, and have my web backend retrieve an access token so it can do the heavy processing work with the Google api.
I've tried following these instructions which are for android: https://developers.google.com/accounts/docs/CrossClientAuth
But I keep getting an invalid scope when I assign the scope as:
oauth2:server:client_id:MY.WEB.CLIENT.ID:api_scope:http://www.google.com/m8/feeds/ https://mail.google.com/ https://www.googleapis.com/auth/plus.login
Anyone successfully implement a similar set up for iOS? If so please explain or share documentation? What libraries or SDKs did you use to get the code from google on the iOS app that the web backend could use to generate a proper access token of it's own?
As of June 18th, the google iOS SDK 1.7.0 supports one-time authorization code which is consistent with the Android feature: https://developers.google.com/+/release-notes/

Resources