{"id":16000642,"url":"https://github.com/iwheelbuy/socialnetwork","last_synced_at":"2026-02-04T08:31:22.168Z","repository":{"id":30955131,"uuid":"126485496","full_name":"iwheelbuy/SocialNetwork","owner":"iwheelbuy","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-06T19:49:00.000Z","size":355,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-03T02:07:37.000Z","etag":null,"topics":["access-token","authorization","facebook","google","oauth","oauth2","odnoklassniki","social-network","vkontakte"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/iwheelbuy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-23T12:57:50.000Z","updated_at":"2020-12-20T19:20:04.000Z","dependencies_parsed_at":"2022-07-24T20:16:27.887Z","dependency_job_id":null,"html_url":"https://github.com/iwheelbuy/SocialNetwork","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/iwheelbuy/SocialNetwork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwheelbuy%2FSocialNetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwheelbuy%2FSocialNetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwheelbuy%2FSocialNetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwheelbuy%2FSocialNetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwheelbuy","download_url":"https://codeload.github.com/iwheelbuy/SocialNetwork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwheelbuy%2FSocialNetwork/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265586109,"owners_count":23792855,"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":["access-token","authorization","facebook","google","oauth","oauth2","odnoklassniki","social-network","vkontakte"],"created_at":"2024-10-08T09:05:19.979Z","updated_at":"2026-02-04T08:31:22.097Z","avatar_url":"https://github.com/iwheelbuy.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SocialNetwork\n\n[![Version](https://img.shields.io/cocoapods/v/SocialNetwork.svg?style=flat)](http://cocoapods.org/pods/SocialNetwork)\n[![License](https://img.shields.io/cocoapods/l/SocialNetwork.svg?style=flat)](http://cocoapods.org/pods/SocialNetwork)\n[![Platform](https://img.shields.io/cocoapods/p/SocialNetwork.svg?style=flat)](http://cocoapods.org/pods/SocialNetwork)\n\n## Usage\n\nInstall via CocoaPods:\n\n```ruby\npod 'SocialNetwork', '0.4.0'\n```\n\nYou can open an official application of a social network or present `SFSafariViewController` for authorization:\n\n```swift\nswitch SocialNetwork.facebook.appExists {\ncase true:\n    UIApplication.shared.openURL(SocialNetwork.facebook.appUrl)\ncase false:\n    let controller = SFSafariViewController(url: SocialNetwork.facebook.oauthUrl)\n    UIApplication.shared.keyWindow?.rootViewController?.present(controller: controller)\n}\n```\n\nTake into account that not each social network allows to authorize via its official application.\n\n## Info.plist setup\n\nTo be able to use `appExists` variable you should provide `LSApplicationQueriesSchemes` for desired social networks:\n\n```swift\n\u003ckey\u003eLSApplicationQueriesSchemes\u003c/key\u003e\n\u003carray\u003e\n    \u003c!-- facebook.com --\u003e\n    \u003cstring\u003efb\u003c/string\u003e\n    \u003cstring\u003efbapi\u003c/string\u003e\n    \u003cstring\u003efbauth\u003c/string\u003e\n    \u003cstring\u003efbauth2\u003c/string\u003e\n    \u003c!-- ok.ru --\u003e\n    \u003cstring\u003eodnoklassniki\u003c/string\u003e\n    \u003cstring\u003eokauth\u003c/string\u003e\n    \u003c!-- vk.com --\u003e\n    \u003cstring\u003evk\u003c/string\u003e\n    \u003cstring\u003evk-share\u003c/string\u003e\n    \u003cstring\u003evkauthorize\u003c/string\u003e\n\u003c/array\u003e\n```\n\nRequired `CFBundleURLTypes` - `socialnetwork`. Other `CFBundleURLTypes` are optional and should be provided only if you plan to use authorization via official applications:\n\n```swift\n\u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n\u003carray\u003e\n    \u003cdict\u003e\n        \u003ckey\u003eCFBundleURLName\u003c/key\u003e\n        \u003cstring\u003eSocialNetwork\u003c/string\u003e\n        \u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n        \u003carray\u003e\n            \u003cstring\u003esocialnetwork\u003c/string\u003e\n            \u003c!-- facebook.com --\u003e\n            \u003cstring\u003efb0123456789\u003c/string\u003e\n            \u003c!-- ok.ru --\u003e\n            \u003cstring\u003eok0123456789\u003c/string\u003e\n            \u003c!-- vk.com --\u003e\n            \u003cstring\u003evk0123456789\u003c/string\u003e\n        \u003c/array\u003e\n    \u003c/dict\u003e\n\u003c/array\u003e\n```\n\n## Redirect URL setup\n\nIn each social network, which is planned to be used for authorization, you should provide a redirect URL:\n\nhttps://iwheelbuy.github.io/SocialNetwork/simplified.html\n\nThe code of redirection html page can be found there:\n\nhttps://github.com/iwheelbuy/SocialNetwork/blob/master/docs/simplified.html\n\n## Basic setup\n\nSet the `SocialNetworkDataSource` and the `SocialNetworkDelegate` somewhere in your project:\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -\u003e Bool {\n    SocialNetwork.dataSource = self\n    SocialNetwork.delegate = self\n    return true\n}\n```\n\nProceed the URL this way:\n\n```swift\nfunc application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -\u003e Bool {\n    if SocialNetwork.didProceed(url: url) {\n        return true\n    }\n    return false\n}\n```\n\nConform to `SocialNetworkDelegate` to receive authorization data:\n\n```swift\nextension AppDelegate: SocialNetworkDelegate {\n    \n    func socialNetwork(socialNetwork: SocialNetwork, didCompleteWithParameters parameters: [String : String]) {\n        // hide authorization controllers if there are some\n        if let token = socialNetwork.getToken(parameters: parameters) {\n            // do something with token\n        }\n    }\n}\n```\n\nConform to `SocialNetworkDataSource` and provide information for required social networks:\n\n```swift\nextension AppDelegate: SocialNetworkDataSource {\n    \n    func socialNetworkClientIdentifier(socialNetwork: SocialNetwork) -\u003e String? {\n        switch socialNetwork {\n        case .facebook:\n            return \"0123456789\"\n        default:\n            return nil\n        }\n    }\n}\n```\n\nThere are some additional optional methods, where you can provide client secret for code flow authorization or change the default permissions:\n\n```swift\nextension AppDelegate: SocialNetworkDataSource {\n    \n    func socialNetworkClientSecret(socialNetwork: SocialNetwork) -\u003e String? {\n        switch socialNetwork {\n        case .facebook:\n            return \"987654321\"\n        default:\n            return nil\n        }\n    }\n    \n    func socialNetworkPermissions(socialNetwork: SocialNetwork) -\u003e String? {\n        switch socialNetwork {\n        case .facebook:\n            return \"public_profile,email\"\n        default:\n            return nil\n        }\n    }\n}\n```\n\n## Author\n\niwheelbuy, iwheelbuy@gmail.com\n\n## License\n\nSocialNetwork is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwheelbuy%2Fsocialnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwheelbuy%2Fsocialnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwheelbuy%2Fsocialnetwork/lists"}