B4i Library iGoogleIdentity - Sign in with Google account

upload_2016-5-2_14-38-36.png

This library is similar to the B4A GoogleIdentity library: https://www.b4x.com/android/forum/threads/googleidentity-sign-in-with-google.66432/#content

It requires some configuration:

1. Follow the steps listed in step #2: https://developers.google.com/identity/toolkit/ios/quickstart#step_1_get_the_quick-start_app

You need to have two keys at the end:
a. API key (Type = iOS)
b. OAuth 2.0 Client Id (Type = iOS)

2. Add the following attributes:
B4X:
#UrlScheme: <your package name>
#UrlScheme: com.googleusercontent.apps.<first part of the the client id>

3. Initialize the IdentityClient:
B4X:
git.Initialize("git", <API key>, <client id>)

4. Call IdentityClient.SigninWithGoogle

5. Handle the Signin event.

The library XML file is attached.

If you are using a local Mac builder then you can download the required files from: www.b4x.com/b4i/files/GoogleIdentity.zip

An example project is attached. You will need to change the ids.
 

Attachments

  • GoogleIdentityExample.zip
    5 KB · Views: 42
  • iGoogleIdentity.xml
    3.5 KB · Views: 26

jazzzzzzz

Active Member
Licensed User
I got this error message and json after coming back to my app from safari.I have followed the exact procedure but dont know why..!

B4X:
Error signing in: Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={data={
Application_Start
Application_Active
Application_Inactive
Application_Background
openURL: com.googleusercontent.apps.229221515003-iks9s37l1oqnglreju31dp59fmggr6b5:/oauth2callback?code=4/uyl3j4QRzonm-uRiRtJk9oc4_iHb71ftCqg5KEGqDek#, com.apple.mobilesafari, (null)
Application_Openurl
Application_Foreground
Application_Active
Error signing in: Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={data={
"error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "CONFIGURATION_NOT_FOUND"
   }
  ],
  "code": 400,
  "message": "CONFIGURATION_NOT_FOUND"
}
}
}
Application_Inactive
Application_Background
 

jazzzzzzz

Active Member
Licensed User
ok that issue was solved by
In the Credentials tab, select the Create credentials drop-down, then select OAuth client ID.
  1. Under Application type, select Web application, even though you are first creating a mobile app. SetAuthorized JavaScript Origins to be https://localhost and Authorized Redirect URIs to behttps://localhost/callback. These are placeholder URLs which you can update to point to your Identity Toolkit web server when you set it up.

How can I get a callback if user closed the safari browser or when go back to our app without selecting account?

Now sign-in callback will be fired only when completing sign-in.
 

jazzzzzzz

Active Member
Licensed User
I dont know why ,but today morning onwards igoogleidentity is not working well in all my apps,yesterday this lib was opening safari and ask for credentials but today when i press login it is not opening safari .Its opening a fullscreen webview in my app itself and login success event is not getting triggered

@Erel Please confirm this. Any One else have this issue now?
 
Top