public static bool LoginUser(Action <bool> callback, bool isSilent, bool enableServerAuth = false, bool forceCodeForeRefreshToken = false, List <string> requestedScopes = null) { LCGoogleLoginBridge.SharedInstance(); authCallback = callback; string[] strScopesArray = null; if (requestedScopes == null || requestedScopes.Count <= 0) { strScopesArray = new string[0]; } else { strScopesArray = requestedScopes.ToArray(); } if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidLoginMethod(LCGoogleLoginAndroid.kUserLogin, isSilent, enableServerAuth, forceCodeForeRefreshToken, strScopesArray)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { int noOfScopes = (strScopesArray == null) ? 0 : strScopesArray.Length; return(LCGoogleLoginiOS.userLogin(isSilent, enableServerAuth, forceCodeForeRefreshToken, strScopesArray, noOfScopes)); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: LoginUser: Unsupported platform"); } } return(false); }
public static string GSIRefreshToken() { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { if (debugLogs) { Debug.Log("LCGoogleLogin: GSIRefreshToken: Always null for android. Check google docs for why so"); } return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrRefreshToken)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { return(LCGoogleLoginiOS.refreshToken()); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: GSIRefreshToken: Unsupported platform"); } } return(null); }
public static void InitWithClientID(string clientID) { if (instance == null) { instance = FindObjectOfType(typeof(LCGoogleLoginBridge)) as LCGoogleLoginBridge; if (instance == null) { instance = new GameObject("LCGoogleLoginBridge").AddComponent <LCGoogleLoginBridge>(); if (string.IsNullOrEmpty(clientID)) { Debug.LogError("LCGoogleLoginBridge: InitWithClientID: Google Web Client ID is required"); return; } if (Application.platform == RuntimePlatform.Android) { LCGoogleLoginAndroid.InitiateWithClientID(clientID); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { LCGoogleLoginiOS.initiateWithClientID(clientID); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: LoginUserBasic: Unsupported platform"); } } } } }
public void SubmitData() { DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference; reference.Child(emailText).Child(LCGoogleLoginBridge.GSIEmail()) .SetRawJsonValueAsync(JsonConvert.SerializeObject(_AppRequest)); reference.Child(messageText.text).Child(_AppRequest.message) .SetRawJsonValueAsync(JsonConvert.SerializeObject(_AppRequest)); reference.Child(locationText.text).Child(_AppRequest.location) .SetRawJsonValueAsync(JsonConvert.SerializeObject(_AppRequest)); StorageReference storage = FirebaseStorage.DefaultInstance.RootReference; Firebase.Storage.StorageReference img_ref = storage.Child("UserImages/user.jpg"); ImageGet.instance.imgTex.GetRawTextureData(); img_ref.PutBytesAsync(ImageGet.instance.imgTex.GetRawTextureData()) .ContinueWith((System.Threading.Tasks.Task <StorageMetadata> task) => { if (task.IsFaulted || task.IsCanceled) { Debug.Log(task.Exception.ToString()); } else { Firebase.Storage.StorageMetadata metadata = task.Result; string download_url = metadata.DownloadUrl.ToString(); Debug.Log("Finished uploading..."); Debug.Log("download url = " + download_url); } }); }
public void ManualInit() { //Keep logging to false in production LCGoogleLoginBridge.ChangeLoggingLevel(true); //For Android, You need to replace it with web client ID. Check details given in LCGoogleLoginBridge file or ReadMe file or tutorial video //For iOS, web client id will be used if you are using server auth. Normal iOS client id is picked up from Google-Services plist file. Its safe to pass null here for iOS if no server auth is used otherwise its ignored by the sdk //#warning Pass web client ID & remove this warning LCGoogleLoginBridge.InitWithClientID("926983986077-ksdfj7dfaarpca31dfane3ag439kar3l.apps.googleusercontent.com"); PrintMessage("Google Login Initialized"); }
public void ManualInit() { if (!Application.isEditor) { LCGoogleLoginBridge.ChangeLoggingLevel(true); LCGoogleLoginBridge.InitWithClientID("926983986077-ksdfj7dfaarpca31dfane3ag439kar3l.apps.googleusercontent.com"); infoText1.text = "Manually Initialized".ToString(); } else { FirebaseCreate("test", "test"); } }
public void SignInServerAuth() { Action <bool> logInCallBack = (Action <bool>)((loggedIn) => { if (loggedIn) { PrintMessage("Google Login Success> " + LCGoogleLoginBridge.GSIUserName()); } else { PrintMessage("Google Login Failed"); } }); LCGoogleLoginBridge.LoginUser(logInCallBack, false, true, false, null); }
public void GrantedScopes() { string[] scopes = LCGoogleLoginBridge.GSIGrantedScopes(); if (scopes == null || scopes.Length <= 0) { PrintMessage("GrantedScopes: None"); } else { string scopeStr = ""; foreach (string scope in scopes) { scopeStr += " " + scope; } PrintMessage("GrantedScopes: " + scopes.Length + scopeStr); } }
public void SignInNormal() { Action <bool> logInCallBack = (Action <bool>)((loggedIn) => { if (loggedIn) { //PrintMessage("Google Login Success> " + LCGoogleLoginBridge.GSIUserName()); infoText1.text = "logged in true".ToString(); FirebaseCreate(LCGoogleLoginBridge.GSIEmail(), "123456"); } else { infoText1.text = "logged in false".ToString(); } }); LCGoogleLoginBridge.LoginUser(logInCallBack, false); }
public static bool LogoutUser() { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidBoolMethod(LCGoogleLoginAndroid.kUserLogout)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { return(LCGoogleLoginiOS.userLogout()); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: LogoutUser: Unsupported platform"); } } return(false); }
public static string GSIServerAuthCode() { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrServerAuthCode)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { return(LCGoogleLoginiOS.serverAuthCode()); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: GSIIDUserToken: Unsupported platform"); } } return(null); }
public void SignInDriveNoServer() { Action <bool> logInCallBack = (Action <bool>)((loggedIn) => { if (loggedIn) { PrintMessage("Google Login Drive Success> " + LCGoogleLoginBridge.GSIUserName()); } else { PrintMessage("Google Login Drive Failed"); } }); //Scopes : https://developers.google.com/identity/protocols/googlescopes LCGoogleLoginBridge.LoginUser(logInCallBack, false, false, false, new List <string>() { "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/drive.photos.readonly" }); }
public static string GSIEmail() { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidStringMethod(LCGoogleLoginAndroid.kStrUserEmail)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { return(LCGoogleLoginiOS.userEmail()); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: GSIPhotoUrl: Unsupported platform"); } } return(null); }
static bool ChangeLoggingDevLevel(bool enabled) { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidInBoolMethod(LCGoogleLoginAndroid.kInBoolChangeDevLogLevel, enabled)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { LCGoogleLoginiOS.changeDevLogLevel(enabled); return(true); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: ChangeLoggingDevLevel: Unsupported platform"); } } return(false); }
public static string[] GSIGrantedScopes() { LCGoogleLoginBridge.SharedInstance(); if (Application.platform == RuntimePlatform.Android) { return(LCGoogleLoginAndroid.CallAndroidStringArrayMethod(LCGoogleLoginAndroid.kStrArrScopes)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { IntPtr scopesArray = LCGoogleLoginiOS.avalableScopes(); int noScopes = LCGoogleLoginiOS.noOfAvalableScopes(); return(LCGoogleLoginiOS.GetCListFromiOSNativeSentData(scopesArray, noScopes)); } else { if (debugLogs) { Debug.Log("LCGoogleLogin: GSIGrantedScopes: Unsupported platform"); } } return(null); }
public void UserToken() { PrintMessage("UserToken: " + LCGoogleLoginBridge.GSIIDUserToken()); }
public void SignOut() { LCGoogleLoginBridge.LogoutUser(); PrintMessage("Logout Done"); }
public void ChangeLogging(bool enable) { logsEnabled = enable; LCGoogleLoginBridge.ChangeLoggingLevel(enable); PrintMessage("ChangeLogging: " + enable); }
//If you are trying to use additional capabilities like server side APIs, you need to pass this will be returned. //Read more about it ServerAuthCode in google docs because very few developers actually need this public void ServerAuthCode() { PrintMessage("ServerAuthCode: " + LCGoogleLoginBridge.GSIServerAuthCode()); }
public void RefreshToken() { PrintMessage("RefreshToken: " + LCGoogleLoginBridge.GSIRefreshToken() + AdditionalAndroidOnlyNotes()); }
public void AccessToken() { PrintMessage("AccessToken: " + LCGoogleLoginBridge.GSIAccessToken() + AdditionalAndroidOnlyNotes()); }
public void UserEmail() { PrintMessage("UserEmail: " + LCGoogleLoginBridge.GSIEmail()); }
public void PhotoUrl() { PrintMessage("PhotoUrl: " + LCGoogleLoginBridge.GSIPhotoUrl()); }
public void UserName() { PrintMessage("UserName: " + LCGoogleLoginBridge.GSIUserName()); }