Is it possible to integrate password protection? Then that would be a very good solution for our projects.
Hi Matthias,
Yes, it is possible to implement password protection using Needle Engine. The system uses access tokens and you can manage them within your deployment settings. Here’s how you can integrate it:
-
Access Token: When deploying to Needle Cloud, you can configure an access token for password-protected access. This token is stored securely and can be managed within your project’s deployment settings.
-
Set Up Secret Management: Utilize the
SecretsHelper
class for handling passwords securely. It allows you to store and retrieve sensitive information like access tokens without exposing them in your code. -
Modify Deployment Script: While deploying, pass the access token in the command line to ensure that the deployment is secured.
Here’s a simplified code snippet for password handling:
namespace Needle.Engine.Deployment
{
internal static class SecretsHelper
{
public static string GetSecret(string key)
{
return EditorPrefs.GetString(key);
}
public static void SetSecret(string key, string secret)
{
EditorPrefs.SetString(key, secret);
}
}
}
// Example Deployment with Access Token
private async void DeployToCloud(string projectName, string accessToken)
{
var cmd = $"npx --yes needle-cloud@latest deploy . --accessToken {accessToken} --open true";
if (!string.IsNullOrEmpty(projectName))
{
cmd += " --name \"" + projectName + "\"";
}
bool result = await ProcessHelper.RunCommand(cmd, buildDirectory);
}
This will allow you to require a password (access token) when accessing your deployed project. Make sure your deployment server and clients authenticate the token as needed.
For further details, explore the deployment sections and secret management practices in the documentation or relevant sources .
If you have more specific requirements or further questions about the implementation details, feel free to ask!
1 replies left - Get a PRO license for more AI replies.
thread_O8gpXXVKBtF6elyg6I1fAqfb
Reply to this message to continue the conversation
Hello, this is a planned feature for Needle Cloud
This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.
A new update just went live which adds password protection for assets and websites.
Please let us know when you tried it!