/// <summary> /// Resets the API credentials to placeholder ones. /// </summary> /// <returns>The previous auth credentials.</returns> public static PolyAuthConfig ResetToPlaceholderCredentials() { PolyAuthConfig oldAuthConfig = PtSettings.Instance.authConfig; // Replace by a placeholder auth config during export. PtSettings.Instance.authConfig = new PolyAuthConfig( apiKey: "** INSERT YOUR API KEY HERE **", clientId: "", clientSecret: ""); EditorUtility.SetDirty(PtSettings.Instance); AssetDatabase.SaveAssets(); return(oldAuthConfig); }
/// <summary> /// Initializes the authenticator. /// /// Note that if config.autoLaunchSignInFlow is true (default), the sign-in flow (browser-based) /// will be launched immediately (unless the user is already authenticated). /// /// If config.autoLaunchSignInFlow is false, then you will remain in unauthenticated state /// until you manually call LaunchSignInFlow(). /// </summary> /// <param name="config">The authentication configuration to use.</param> public static void Initialize(PolyAuthConfig config) { PolyUtils.AssertTrue(instance == null, "Authenticator.Initialize called twice."); GameObject hostObject = PolyInternalUtils.CreateSingletonGameObject("PolyToolkit Authenticator"); instance = hostObject.AddComponent <Authenticator>(); // Currently, authentication is only supported on Windows/Mac for now. PtDebug.LogFormat("Platform: {0}, authentication supported: {1}", Application.platform, instance.IsAuthenticationSupported); if (instance.IsAuthenticationSupported) { InitializeCertificateValidation(); instance.Setup(config); } }
private void Setup(PolyAuthConfig config) { oauth2Identity = gameObject.AddComponent <OAuth2Identity>(); oauth2Identity.Setup(config.serviceName, config.clientId, config.clientSecret, config.additionalScopes != null ? string.Join(" ", config.additionalScopes) : ""); }
public TempPrepareSettingsForExport() { oldAuthConfig = ResetToPlaceholderCredentials(); }