Skip to content

Solución en .NET para obtener un token de autorización del SII (Chile) mediante servicios SOAP. Incluye una Minimal API que firma digitalmente la semilla con un certificado .pfx almacenado en Azure Blob Storage y obtiene un token.

License

Notifications You must be signed in to change notification settings

sergioocode/Sii.ObtenerTokenAuth

Repository files navigation

 .NET GitHub commit activity GitHub contributors GitHub code size in bytes

Obtener Token de autorización SII

This solution demonstrates how to programmatically obtain an authentication token from Chile's Servicio de Impuestos Internos using WCF SOAP services. It makes use of the following official SOAP endpoints:

It includes:

  • Minimal API for secure access to SOAP services
  • XML Digital Signature using a .pfx certificate
  • Digital certificate retrieval from Azure Blob Storage

This repository has no relationship with the government entity SII, only for educational purposes.


📦 Details

Package Reference Version
Azure.Storage.Blobs 12.24.0
Microsoft.Extensions.Azure 1.7.6

🚀 Usage

This solution exposes a Minimal API endpoint that allows you to request through a simple HTTP GET. Once the app is running, you can call the endpoint:

curl http://localhost:5058/api/token \
  -H "Accept: application/json"

The response will be a JSON payload with the token issued by the SII :

{
  "token": "XYZ123456789",
  "fecha": "2025-04-02T17:00:00Z"
}

⚙️ Configuration

Use appsettings.json or environment variables to configure the certificate source:

{
  "StorageConnection": "UseDevelopmentStorage=true",
  "StorageConnection:ContainerName": "certificados",
  "StorageConnection:BlobName": "certificado1.pfx",
  "StorageConnection:CertPassword": "<your-cert-password>"
}

You may also define these as Azure App Settings if you're deploying the API to the cloud.


📢 Have a question? Found a Bug?

Feel free to file a new issue with a respective title and description on the Sii.ObtenerTokenAuth/issues repository.


💖 Community and Contributions

If this tool was useful, consider contributing with ideas or improving it further.

Azure Function


📘 License

All my repository content is released under the terms of the GNU General Public License v3.0.

About

Solución en .NET para obtener un token de autorización del SII (Chile) mediante servicios SOAP. Incluye una Minimal API que firma digitalmente la semilla con un certificado .pfx almacenado en Azure Blob Storage y obtiene un token.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages