跳到正文

快速开始

SDK 与库

用于 Sign in with Identvia 与 AgentPass 的官方客户端。每个软件包均在 Identvia 组织下于 GitHub 开源。

复制给你的 AI 代理用的提示词

在用编程代理?这段提示词会把它指向这些文档,并列出它必须遵守的规则。像审查其他代码一样审查它写的代码。

You are helping me add "Sign in with Identvia" to my app (PHP). Identvia is an OpenID Connect provider.

Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration

Stack: plain PHP 8.1+ (no framework). Use the official SDK identvia/identvia-php (composer require identvia/identvia-php, or the zip with vendor/ from https://id.identvia.com/developers/docs/php for hosts without Composer). Create identvia.php (config), login.php (redirectToSignIn), callback.php (handleCallback, then session_regenerate_id(true) and store sub) and logout.php. Read secrets from environment variables or a config file outside the web root.

Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.

Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md

Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.

identvia-js

JavaScript / TypeScript

浏览器与 Node 的 OIDC 客户端,另有可选的 React 辅助。

安装
npm install @identvia/js
在 GitHub 上查看

identvia-react-native

React Native / Expo

适用于 Expo 与 React Native 应用的原生登录。

安装
npx expo install @identvia/react-native expo-web-browser expo-secure-store expo-crypto
在 GitHub 上查看

identvia-flutter

Flutter

在 iOS 与 Android 上使用 Sign in with Identvia 的 Flutter 包。

安装
flutter pub add identvia
在 GitHub 上查看

identvia-swift

Swift / iOS

面向 iOS 与 macOS 的 Swift Package Manager 客户端。

安装
.package(url: "https://github.com/Identvia/identvia-swift", from: "0.1.0")
在 GitHub 上查看

identvia-android

Android / Kotlin

带 Custom Tabs 与 App Links 的 Kotlin 客户端。

安装
implementation("com.identvia:identvia-android:0.1.0")
在 GitHub 上查看

identvia-dotnet

.NET

面向 Identvia 的 ASP.NET Core 身份验证处理程序。

安装
dotnet add package Identvia.AspNetCore
在 GitHub 上查看

identvia-wordpress

WordPress

在 WordPress 上使用 Sign in with Identvia(PKCE 机密客户端)。

安装
Copy to wp-content/plugins/identvia-login and activate
在 GitHub 上查看

identvia-php

PHP

纯 PHP 8.1+ OIDC SDK;可从此服务器下载 zip。

安装
composer require identvia/identvia-php
在 GitHub 上查看

agentpass-php

PHP (AgentPass)

面向 AgentPass v0.1 联邦权威的服务端 SDK。

安装
composer require identvia/agentpass-php
在 GitHub 上查看

需要上手指南?从 Quickstart 或 PHP SDK 文档开始。在 开发者控制台 创建应用时也会看到按平台的提示。