SDKs
Official IDkollen SDKs wrap the REST API and handle authentication, serialization, and response parsing for you.
The SDKs are in an early experimental stage and are available for evaluation purposes only. If you would like to give us feedback before it's finalized, reach out to support@idkollen.se.
C# / .NET
A typed .NET API client for server-side applications.
- Docs: https://github.com/idkollen/idk-clients/tree/main/csharp
- Package: https://www.nuget.org/packages/Idkollen.Client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/csharp
Installation
dotnet add package Idkollen.Client
Example
using Idkollen.Client;
using Idkollen.Client.Models;
var client = new IdkollenClientBuilder("client_id", "client_secret")
.Environment(Environment.Staging)
.Build();
var session = await client.BankIdSe.AuthAsync(new BankIdSeAuthRequest());
if (session is BankIdSePending pending)
{
Console.WriteLine($"Session ID: {pending.Id}");
var result = await client.BankIdSe.WaitForAuthAsync(pending.Id);
switch (result)
{
case BankIdSeCompleted done:
Console.WriteLine($"Authenticated: {done.Name} ({done.Ssn})");
break;
case BankIdSeFailed failed:
Console.WriteLine($"Failed: {failed.Error}");
break;
}
}
Dart
A typed Dart API client for Flutter and server-side applications.
- Docs: https://pub.dev/documentation/idkollen_client/latest/
- Package: https://pub.dev/packages/idkollen_client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/dart
Installation
dart pub add idkollen_client
Example
import 'package:idkollen_client/idkollen_client.dart';
Future<void> main() async {
final client = IdkollenClientBuilder('client_id', 'client_secret')
.environment(Environment.staging)
.build();
final session = await client.bankIdSe.auth(const BankIdSeAuthRequest());
if (session is BankIdSePending) {
print('Session ID: ${session.id}');
final result = await client.bankIdSe.waitForAuth(session.id);
final message = switch (result) {
BankIdSeCompleted(:final name, :final ssn) => 'Authenticated: $name ($ssn)',
BankIdSeFailed(:final error) => 'Failed: $error',
BankIdSePending() => 'Still pending',
};
print(message);
}
client.close();
}
Go
A typed Go API client for server-side applications.
- Docs: https://pkg.go.dev/github.com/idkollen/idk-clients/go/idkollen
- Package: https://pkg.go.dev/github.com/idkollen/idk-clients/go/idkollen
- GitHub: https://github.com/idkollen/idk-clients/tree/main/go
Installation
go get github.com/idkollen/idk-clients/go/idkollen
Example
package main
import (
"context"
"fmt"
idkollen "github.com/idkollen/idk-clients/go/idkollen"
)
func main() {
client := idkollen.NewClientBuilder("client_id", "client_secret").
Environment(idkollen.Staging).
Build()
response, err := client.BankIdSe().Auth(context.Background(), idkollen.BankIdSeAuthRequest{})
if err != nil {
panic(err)
}
if pending, ok := response.(*idkollen.BankIdSePending); ok {
fmt.Println(pending.Id)
}
}
JavaScript / TypeScript
A typed JavaScript/TypeScript API client with support for Node.js, Deno, Bun and browser environments.
- Docs: https://idkollen.github.io/idk-clients/js/
- Package: https://www.npmjs.com/package/@idkollen/client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/js
Installation
npm install @idkollen/client
Example
import { IdkollenClientBuilder, BankIdSeAuthRequest } from "@idkollen/client";
const client = new IdkollenClientBuilder("client_id", "client_secret")
.environment("staging")
.build();
const response = await client.bankidSe().auth(new BankIdSeAuthRequest());
console.log(response.id);
JVM (Java / Kotlin)
A JVM API client with support for Java and Kotlin.
- Docs: https://idkollen.github.io/idk-clients/jvm/
- Package: https://central.sonatype.com/artifact/se.idkollen/idkollen-client-core
- GitHub: https://github.com/idkollen/idk-clients/tree/main/jvm
Installation
Gradle (Kotlin DSL):
implementation("se.idkollen:idkollen-client-core:0.1.0")
// Kotlin coroutines extensions
// implementation("se.idkollen:idkollen-client-kotlin:0.1.0")
Maven:
<dependency>
<groupId>se.idkollen</groupId>
<artifactId>idkollen-client-core</artifactId>
<version>0.1.0</version>
</dependency>
Example
Kotlin:
import se.idkollen.client.*
import se.idkollen.client.models.BankIdSeAuthRequest
suspend fun main() {
val client = idkollenClient("client_id", "client_secret") {
environment(Environment.STAGING)
}
val response = client.bankIdSe().auth(BankIdSeAuthRequest())
println(response.id)
}
Java:
import se.idkollen.client.IdkollenClientBuilder;
import se.idkollen.client.models.BankIdSeAuthRequest;
void main() {
var client = new IdkollenClientBuilder("client_id", "client_secret")
.environment(Environment.STAGING)
.build();
var response = client.bankIdSe().auth(new BankIdSeAuthRequest()).join();
IO.println(response.id());
}
PHP
A typed PHP API client for server-side applications.
- Docs: https://idkollen.github.io/idk-clients/php/
- Package: https://packagist.org/packages/idkollen/client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/php
Installation
composer require idkollen/client guzzlehttp/guzzle
A PSR-18 HTTP client is required. The client auto-discovers Guzzle if installed; alternatively, inject any PSR-18 client via the builder.
Example
<?php
use Idkollen\Client\Environment;
use Idkollen\Client\IdkollenClientBuilder;
use Idkollen\Client\Models\BankIdSe\BankIdSeAuthRequest;
use Idkollen\Client\Models\BankIdSe\BankIdSePending;
$client = (new IdkollenClientBuilder('client_id', 'client_secret'))
->environment(Environment::Staging)
->build();
$response = $client->bankIdSe()->auth(new BankIdSeAuthRequest());
if ($response instanceof BankIdSePending) {
echo $response->id . PHP_EOL;
}
Python
A typed Python API client with support for both synchronous and asynchronous usage via httpx.
- Docs: https://idkollen.github.io/idk-clients/py/
- Package: https://pypi.org/project/idkollen-client/
- GitHub: https://github.com/idkollen/idk-clients/tree/main/py
Installation
pip install idkollen-client
Example
Sync:
from idkollen_client import IdkollenClientBuilder
from idkollen_client.models import BankIdSeAuthRequest
client = (
IdkollenClientBuilder("client_id", "client_secret")
.environment("staging")
.build()
)
response = client.bankid_se().auth(BankIdSeAuthRequest())
print(response.id)
Async:
import asyncio
from idkollen_client import IdkollenClientBuilder
from idkollen_client.models import BankIdSeAuthRequest
async def main():
client = (
IdkollenClientBuilder("client_id", "client_secret")
.environment("staging")
.build_async()
)
response = await client.bankid_se().auth(BankIdSeAuthRequest())
print(response.id)
asyncio.run(main())
Ruby
A typed Ruby API client for server-side applications.
- Docs: https://github.com/idkollen/idk-clients/tree/main/ruby
- Package: https://rubygems.org/gems/idkollen-client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/ruby
Installation
gem install idkollen-client
Or add to your Gemfile:
gem 'idkollen-client', '~> 0.1'
Example
require 'idkollen/client'
client = Idkollen::ClientBuilder.new('client_id', 'client_secret')
.environment(Idkollen::Environment::STAGING)
.build
session = client.bank_id_se.auth(Idkollen::BankIdSe::AuthRequest.new)
puts "Session ID: #{session.id}" if session.is_a?(Idkollen::BankIdSe::Pending)
result = client.bank_id_se.wait_for_auth(session.id)
case result
in Idkollen::BankIdSe::Completed(ssn:, name:)
puts "Authenticated: #{name} (#{ssn})"
in Idkollen::BankIdSe::Failed(error:)
puts "Failed: #{error}"
end
Rust
A type-safe sync/async Rust API client for the IDkollen REST API.
- Docs: https://docs.rs/idkollen-client
- Package: https://crates.io/crates/idkollen-client
- GitHub: https://github.com/idkollen/idk-clients/tree/main/rust
Installation
cargo add idkollen-client
Example
use idkollen_client::{IdkollenClientBuilder, Environment};
use idkollen_client::models::BankIdSeAuthRequest;
#[tokio::main]
async fn main() {
let client = IdkollenClientBuilder::new("client_id", "client_secret")
.environment(Environment::Staging)
.build()
.unwrap();
let response = client
.bankid_se()
.auth(BankIdSeAuthRequest::new())
.await
.unwrap();
println!("{}", response.id);
}
Swift
A typed Swift API client for iOS, macOS, tvOS and watchOS applications. Supports iOS 15+, macOS 12+, tvOS 15+ and watchOS 8+.
- Docs: https://github.com/idkollen/idk-clients/tree/main/swift
- Package: Swift Package Manager
- GitHub: https://github.com/idkollen/idk-clients/tree/main/swift
Installation
Add to Package.swift:
dependencies: [
.package(url: "https://github.com/idkollen/idk-clients.git", from: "0.1.0")
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "IdkollenClient", package: "idk-clients")
])
]
Example
import IdkollenClient
let client = IdkollenClientBuilder(clientId: "client_id", clientSecret: "client_secret")
.environment(.staging)
.build()
let session = try await client.bankIdSe.auth(BankIdSeAuthRequest())
if case .pending(let pending) = session {
print("Session ID: \(pending.id)")
let result = try await client.bankIdSe.waitForAuth(id: pending.id)
switch result {
case .completed(let done):
print("Authenticated: \(done.name) (\(done.ssn))")
case .failed(let failed):
print("Failed: \(failed.error)")
case .pending:
break
}
}