{"id":18470244,"url":"https://github.com/miwr/vkid-dart-sdk","last_synced_at":"2026-05-12T07:39:03.133Z","repository":{"id":252105426,"uuid":"839417312","full_name":"mIwr/vkid-dart-sdk","owner":"mIwr","description":"VK ID OAuth API","archived":false,"fork":false,"pushed_at":"2024-09-20T08:45:50.000Z","size":267,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-09T00:12:17.467Z","etag":null,"topics":["android","ios","oauth","vk","vk-id","web"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mIwr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T15:06:48.000Z","updated_at":"2024-12-29T07:53:32.000Z","dependencies_parsed_at":"2024-12-25T09:44:00.778Z","dependency_job_id":"e6d0898a-ecca-4b79-a72f-c6dc110abbb1","html_url":"https://github.com/mIwr/vkid-dart-sdk","commit_stats":null,"previous_names":["miwr/vkid-dart-sdk"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2Fvkid-dart-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2Fvkid-dart-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2Fvkid-dart-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2Fvkid-dart-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mIwr","download_url":"https://codeload.github.com/mIwr/vkid-dart-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166523,"owners_count":21864482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","oauth","vk","vk-id","web"],"created_at":"2024-11-06T10:13:23.835Z","updated_at":"2026-05-12T07:39:03.128Z","avatar_url":"https://github.com/mIwr.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VK ID\n\n[![pub package](https://img.shields.io/pub/v/vk_id.svg)](https://pub.dev/packages/vk_id)\n[![License](https://img.shields.io/badge/license-MIT-purple.svg)](./LICENSE)\n\nPure dart impl of [OAuth VK ID API](https://id.vk.com/about/business/go/docs/ru/vkid/latest/vk-id/connection/api-integration/api-description).\nThe module allows to generate 'authorize' link, retrieve OAuth token and user data\n\n## General\n\n- Dart SDK \u003e=3.0.0\n\nSupports 2 modes:\n\n- [Front-end authorization code exchange without SDK](https://id.vk.com/about/business/go/docs/ru/vkid/latest/vk-id/connection/web/auth-flow-web#Bez-SDK-s-obmenom-koda-na-frontende): Generating random code_verifier and state at front-end\n- [Back-end authorization code exchange without SDK](https://id.vk.com/about/business/go/docs/ru/vkid/latest/vk-id/connection/web/auth-flow-web#Bez-SDK-s-obmenom-koda-na-bekende): Generating random code_verifier and state at back-end and sending code_challenge with state to front-end\n\nSupports VK app platforms:\n\n- Android\n- iOS\n- Web\n\n**Notice: You aren't strictly bound between the hardware and the VK app platform. For example, you can authorize on iOS VK app using Android device or desktop PC**\n\nSupports VK ID APIs:\n\n- Generating 'auhtorize' link for VK ID with code_verifier or code_challenge\n- Exchange received from passed user login redirect authorization code for access, refresh, id tokens\n- Refresh access token through refresh token\n- Get public (masked) user info\n- Get full (unmasked) user info\n- Revoke permissions for authorization\n- Invalidate authorization (Logout)\n\n**Notice: This module doesn't support user authorization. Use webview on flutter context to do it**\n\n## Setup\n\n1. [Create and setup VK app](https://id.vk.com/about/business/go/docs/ru/vkid/latest/vk-id/connection/create-application)\n2. Create [VkIDController](./lib/src/controller/vk_id_controller.dart) instance with VK app client ID\n\n**If you have previously saved authorization, you can set init oauth and profile data for controller ctor**\n\n## Authorization\n\n### Generating authorize link\n\nYou may generate authorize link itself (redirect_uri and code_challenge or code_verifier) or request the generated link from back-end\n\n- Android, iOS: Redirect uri must be 'vk{clientID}://vk.ru/blank.html'. Otherwise VK will throw an error for authorize\n- Web: Redirect uri must match with uri from VK web app settings. Also you can use default value from Android and iOS apps (vk{clientID}://vk.com/blank.html)\n\n**Authorize link generation examples**\n\n1. Android and iOS with code_challenge\n```dart\nfinal controller = VkIDController(clID: 1234567890);\n//Generate code_verifier and code_challenge itself or get code_challenge from back-end\nfinal codeChallenge = \"1234567890RND0987654321\";\nfinal uri = controller.generateAuthorizeLinkWithCodeChallenge(codeChallenge: codeChallenge);\n```\n\n2. Android and iOS with random code_verifier\n```dart\nfinal controller = VkIDController(clID: 1234567890);\nfinal codeVerifierWithUri = controller.generateAuthorizeLinkWithCodeVerifier();\n```\n\n3. Android and iOS with user-defined code_verifier\n```dart\nfinal controller = VkIDController(clID: 1234567890);\n//Generate code_verifier\nfinal codeVerifier = \"1234567890RND0987654321\";\nfinal codeVerifierWithUri = controller.generateAuthorizeLinkWithCodeVerifier(codeVerifier: codeVerifier);\n```\n\n4. Web with code_challenge and user-defined redirect_uri from VK web app settings\n```dart\nfinal controller = VkIDController(clID: 1234567890);\nfinal redirectUri = \"https://site.com/redirect\";\n//Generate code_verifier and code_challenge itself or get code_challenge from back-end\nfinal codeChallenge = \"1234567890RND0987654321\";\nfinal uri = controller.generateAuthorizeLinkWithCodeChallenge(codeChallenge: codeChallenge, redirectUri: redirectUri);\n```\n\n5. Web with code_challenge and default redirect_uri \n```dart\nfinal controller = VkIDController(clID: 1234567890);\n//Generate code_verifier and code_challenge itself or get code_challenge from back-end\nfinal codeChallenge = \"1234567890RND0987654321\";\nfinal uri = controller.generateAuthorizeLinkWithCodeChallenge(codeChallenge: codeChallenge);\n```\n\n6. Web with random code_verifier and user-defined redirect_uri from VK web app settings\n```dart\nfinal controller = VkIDController(clID: 1234567890);\nfinal redirectUri = \"https://site.com/redirect\";\n//Generate code_verifier\nfinal codeVerifier = \"1234567890RND0987654321\";\nfinal codeVerifierWithUri = controller.generateAuthorizeLinkWithCodeVerifier(codeVerifier: codeVerifier);\n```\n\n7. Web with random code_verifier and default redirect_uri\n```dart\nfinal controller = VkIDController(clID: 1234567890);\n//Generate code_verifier\nfinal codeVerifier = \"1234567890RND0987654321\";\nfinal codeVerifierWithUri = controller.generateAuthorizeLinkWithCodeVerifier(codeVerifier: codeVerifier);\n```\n\n### Authorizing on VK ID\n\n**You need webview (flutter context) to handle it**\n\nPass authorize link to webview. Also include NavigationDelegate for preventing redirect navigation requests. See [example](./example/lib/ui/oauth_screen_mobile.dart) for details\nOn success authorization you will be redirected by uri from redirect_uri + query parameters\n\n- Front-end mode: Block redirect from id.vk.ru on webview context (Prevent navigation request). Also you need extract 'code' and 'device_id' parameters from query for exchanging OAuth token\n- Back-end mode: If VK app is web, don't block redirect. Otherwise block it and process authorization data\n\n### Retrieve OAuth token\n\n- Front-end mode: Use controller method to exchange authorization_code for access_token\n- Back-end mode: Send, if needed, data to back-end for exchanging\n\n**VK ID controller refreshes the access token itself if necessary**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiwr%2Fvkid-dart-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiwr%2Fvkid-dart-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiwr%2Fvkid-dart-sdk/lists"}