Error 500 while Sharing via Google plus - ios

We are developing an application which uses google plus share's sdk 1.7.1 .It was working fine until we changed the bundle-id in console of google Developers.So we create a new client-id,the it started giving an error 500 in safari after loging in succesfully just before redirecting to the app.we have checked the schema which is correct.This issue does not occurs every time.
We have also set the Url Types both identifier and schema correctly.

Just to confirm your steps:
Register iOS app in developer console
Change app bundle ID
Sharing breaks (error 500)
You change the bundle identifier associated with the client id shipping in your app
Sharing is still broken.
A few things that could break this:
Updating the bundle identifier sometimes causes issues, you might want to register an additional client all together and use this client ID.
Ensure that you have updated the Client ID in your sample to match any changes in the client ID that could have occurred in the console.

Related

How should cross-platform login work with Parse server? (Getting invalid session token)

I'm working on a cross-platform app (iOS & web) that uses Parse server (and Parse iOS SDK on iOS). When switching between the iOS app and the web app, I get an "invalid session token" error that prevents any further calls to Parse from succeeding. In other words, here are the steps that lead to this error:
Sign up for an account on iOS
Send the app into the background (does not log you out)
Open the web app in a browser and log in
Either close the tab/browser or log out, it doesn't matter
Open the iOS app, and an invalid session token error will occur when trying to make any calls to Parse
The same thing happens in reverse as well, so if you starting sign-up on the web, then log in on iOS, then back to web again, calls to Parse will fail for the web app.
I can see that when logging in (or signing up) on one platform creates an entry in the Sessions table, and then logging in on another platform will replace that entry with a new one for that user. Then when returning to the other platform, the Session entry will be different (with a different token) causing the error.
What is the best way to deal with this? Do sessions need to be managed manually in such a case? Of course, I could just pop up an error for the user to inform them that their session has expired and has to log in again, but it would be much nicer not to do that.
So does each platform need its own Session or is there a way to share sessions?
I'm currently using Parse iOS SDK 1.14.4 with Parse Server 2.3.7. And in the iOS app, I am calling enableRevocableSessionInBackground().

Google 400 Error: invalid request Custom scheme URIs are not allowed for 'Web' client type

When I am signing into Gmail in my iOS App, I am getting the below error (screenshot) and the sign-in fields do not appear. We are loading the sign-in screen in a WKWebView.
We are using a custom URI redirect but why is google throwing this error now. What are the alternatives to a custom URI?
Swift 2.3 project
Using OAuthSwift v0.6.0 cocoapod
This started quite recently only in the past week or so I believe something changed with Google's APIs.
I have read that google is deprecating webviews for OAuth and will block requests on April 20, 2017. As seen here in a Google Developers Blog:
https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html
Does this mean I already need to use or is there another viable solution? I thought I had more time before needing to update this.
My guess is that your client is registered incorrectly in Google Cloud Console. A 'WEB' client is typically a server or Javascript application. An iOS app should be registered as an iOS client.
https://developers.google.com/identity/protocols/OAuth2InstalledApp#creatingcred
I Just found this problem too.
Please check google developer console and look at the credentials keys
Your Client ID in google-info plist must come from iOS application, not the web.
And use that Client ID to be revereseClientID and copy it in to URI type
I have solved the problems by create project in Fire Base Because REVERSED_CLIENT_ID generate from developers.google.com Incorrect.
Try create your project in FireBase
https://console.firebase.google.com
you must cross check clientId at your 'Google Dashboard' clientId and clientId at "GoogleProject.Plsit".if both are different, copy ClientID from 'Google Dashboard' and paste it on "GoogleService-Info.Plsit".and also amend your reverseClientId in "GoogleService-Info.Plsit" according to newly pasted ClientID(you check the pattern how reverseClientId created from client Id in "GoogleService-Info.Plsit"). And then paste thid reverseClientId in 'URL type' in your project setting.
In case of mine clientId on "GoogleService-Info.Plsit" and my 'Google Dashboard' were different.
chech your google dashboard here : https://console.developers.google.com/apis/credentials?project=firebase
I just experienced this issue following the Google Signin for iOS Guide. The plist generated file is not the good one. You need to take a look at the clientID and reversedClientID and be sure that they are the ones for the iOS app on your Google developer portal.
I faced this error after previously creating a GoogleService-Info.plist file using the site Google Sign In directs you to. I later started using Firebase, which seems to create a separate .plist file. After attempting to include Firebase's new .plist file, my Google Sign In button started yielding the invalid_request error with the Custom scheme URIs are not allowed for WEB client type message.
In order to fix the problem I tried many things, but in the end deleting MY ENTIRE Firebase project on their web console (not just the individual app), recreating a new Firebase project from scratch, and re-downloading the new .plist file, solved the error.
It creates two client ID. one for web and one for iOS application. Web client will be in the google plist by default. So it gives the above error. Use iOS Client id from google console or create credential for iOS application.
For my experience, I had followed Google's SignIn iOS Swift guide and had downloaded a Web OAuth JSON file. They literally provide you the wrong Plist file for an iOS setup.
Just in case somebody else runs into this issue here are the steps I followed:
Go to the Google Developers console.
Go to the Credentials section.
Notice there are two items in the "OAuth 2.0 client IDs" section. (If you previously attempted to configure an iOS Google SignIn project.
Click on the name of the "iOS client for ".
Click "Download PLIST File".
Delete the Google web Plist file from your project.
Drop in the new iOS based Plist file.
Copy over the new REVERSED_CLIENT_ID into your URL Types of the Info page of your project. (This is detailed in Google's guide).
Attempt to run your app again.
Note: I got the Google Sign In API to work with Swift v3 and XCode v8.
I was getting the same error. Then I figured out, that I did not provide my app Bundle Id to access the Google Sign In Service in my app.
You do that from the page with the link:
https://developers.google.com/mobile/add?platform=ios&cntapi=signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fios%2Fsign-in%3Fconfigured%3Dtrue&cntlbl=Continue%20Adding%20Sign-In
1.Sign in with your Google Developer account.
2.Create you app name and copy the App bundle Id from your project from:
Project and Target List> General> Bundle Identifier.
3.Choose your Country
4.Enable Google- Sign In.
Then perform the necessary steps to integrate Google Sign In in with your iOS App.
I was facing the same issue. I followed all the instructions to integrate my app several times, and played with the code to see if there was any hidden issue in the code.
I downloaded and configured the sample app from google at github https://github.com/googlesamples/google-services and go the same issue, so it was not the code.
It seemed like there is something in my console configuration so I switched between different google console apps, and played changing the bundle IDs.
The only thing that managed to fix this issue was to use Firebase instead. I created an app in the firebase console, downloaded the new plist, and it worked.
Still not sure why this didn't work for me in the first place, this doesn't seem to be a common problem, but I hope this helps someone.
cheers,
Kindly check console.developers.google.com/apis/credentials for your project and see whether there is already a client_id in OAuth 2.0 client IDs section , if so then copy that client id and replace it with you GoogleService-Info.plist file's CLIENT_ID and accordingly change REVERSED_CLIENT_ID (in reverse manner) now clean and build your app and test it will work
I was using Meteor with Cordova and Meteor's official google integration, which relies on cordova-plugin-googleplus.
I had to:
create both an iOS and a web Client ID
use the web Client ID on the settings / server / database as documented
but then use the reverse of the iOS web client as the REVERSED_CLIENT_ID for cordova-plugin-googleplus
Expo, authentication with Google.logInAsync from expo-google-app-auth
In my case I just used androidClientId instead of androidStandaloneAppClientId

iOS - Google SignIn fails if a Google App is on the device

I've integrated Google SignIn (2.2) based on instructions here:
https://developers.google.com/identity/sign-in/ios/start
It works when there is no Google app on the device. So Google SDK opens a web view where I can sign in a google account, and GIDSignInDelegate method didSignInForUser is called with a valid access token with no error.
But if I have Google app or Youtube app installed, the SDK will open the Google app, where I can sign in my google account, and when I choose the account and it redirects back, it throws an error:
"A potentially recoverable error occured. You may try again."
No matter how many times I retry it never worked.
(Deep link url:
com.googleusercontent.apps.<my app id>://api/sso/v1/tokenResponse?ec=-216414001&e=A%20potentially%20recoverable%20error%20occured.%20You%20may%20try%20again)
Has anyone seen the same issue? What could go wrong?
So it turns out to be a typo in the app bundle id in Google Developers Console.
As requested in some comments, here are some more details:
In order to support google sign in, you need to a client id in
https://console.developers.google.com
under APIs & Auth/Credential
In our case, we were seeing the error because in the client id we created for iOS app, we had a typo in the app bundle id. (Instead of com.companyname.appname we typed com.companyname.companyname)
I guess there can be other ways to cause the same error, but one good place to check is the developer console (https://console.developers.google.com), just make sure every field makes sense to you.
Create a new Configuration file here -> https://developers.google.com/mobile/add?platform=ios&cntapi=signin&cntapp=Default%20Demo%20App&cntpkg=com.google.samples.quickstart.SignInExample&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fios%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue%20Try%20Sign-In
When it asks for your iOS Bundle Id, make sure it matches the bundle id that you find in your Xcode project settings (target -> General -> Bundle Identifier)
Delete the old "GoogleService-Info.plist" file and replace it with the new one you just created
clean, rebuild, try to sign in again

Change Facebook developer account for an iOS app - bundle identifier

I've developed an iOS app that is integrated with Facebook to allow users to log in using their FB accounts. That works fine.
The app is also supposed to use a web service developed by another company. Said web service also uses Facebook integration.
Both my app and the web service were developed using different Facebook developer accounts. Now it seems a major problem I've got needs both of these to be part of the same "Facebook application" which means they'd have to belong to the same Facebook developer account.
I asked the other company's developer to add a native iOS aspect to his Facebook app, gave him my app's bundle ID and received a Facebook app ID and secret in return. I made the appropriate changes to my app's Info tab in XCode - the bundle ID is the same one that I gave him, the FacebookAppID is the one I got from him and so is the URL Schemes thing (with an "fb" preceding the actual FBAppID).
However, when I try to log in using Facebook credentials in the app, I constantly get com.facebook.sdk error 2 which is explained in the console by this message: FBSDKLog: System authorization failed:'The Facebook server could not fulfill this access request: remote_app_id does not match stored id '. This may be caused by a mismatch between the bundle identifier and your app configuration on the server at developers.facebook.com/apps.
Is there a step I'm missing in this transition of app between FB developer accounts? Could something else be the cause of the problem here? If my question is off-topic, please at least point me in the direction where I could get some answers.
Indeed - it turned out that the problem was exactly what the error message said: the bundle ID was different for both the application in XCode and in the Facebook developer account; that was because the developer from the other company made a spelling mistake (lower case instead of upper case letter) in the bundle ID.

Google API fails to authenticate when iOS client ID is used

I'm trying to integrate the Google Data API into my application. I'm using the ObjC wrapper available here:
http://code.google.com/p/gdata-objectivec-client
but I have got some issues with the authentication. Basically I'm following the steps as described here:
http://code.google.com/p/gtm-oauth2/wiki/Introduction#Signing_In_to_Google_Services
I have created a project on the API Console and added two client IDs for installed applications: one is of the "Other" platform, the other is "iOS" with the bundle ID appropriately set (though I left the appstore id 0 for the moment). Now comes the interesting part.
Both the YouTubeSample app bundled with the above wrapper library AND my iOS app work perfectly with the client ID belonging to the "Other" platform, and both of them return a 400 invalid_client error when I switch the ID for the iOS one. I have doublechecked the client IDs and secrets, all are correct. The iOS app has of course been given the correct bundle ID.
So, am I missing something trivial here?
Is there a reason that you need to use the iOS-type id/secret pair instead of the other-type pair? Perhaps I'm missing something, but the linked documentation states to not use an iOS type client id:
In the console, create a project, then click "API Access" in the left column. Create a new Client ID for an Installed Application (not a web application) type other (not iOS). This will provide Client ID and Secret strings to be used with the controller.
The controller likely doesn't identify itself as an iOS application when sending the requests, which Google probably checks when it receives an iOS id/secret pair.

Resources