{"id":15471934,"url":"https://github.com/dkhamsing/githuboauthcontroller","last_synced_at":"2025-04-22T13:46:34.462Z","repository":{"id":31313897,"uuid":"34876280","full_name":"dkhamsing/GitHubOAuthController","owner":"dkhamsing","description":":octocat: Simple GitHub OAuth Controller for iOS","archived":false,"fork":false,"pushed_at":"2016-03-26T03:11:15.000Z","size":6395,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T03:52:40.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":false,"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/dkhamsing.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}},"created_at":"2015-04-30T20:53:30.000Z","updated_at":"2025-02-28T19:44:35.000Z","dependencies_parsed_at":"2022-08-21T03:20:31.495Z","dependency_job_id":null,"html_url":"https://github.com/dkhamsing/GitHubOAuthController","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkhamsing%2FGitHubOAuthController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkhamsing%2FGitHubOAuthController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkhamsing%2FGitHubOAuthController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkhamsing%2FGitHubOAuthController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkhamsing","download_url":"https://codeload.github.com/dkhamsing/GitHubOAuthController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250251327,"owners_count":21399800,"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":[],"created_at":"2024-10-02T02:22:33.661Z","updated_at":"2025-04-22T13:46:34.441Z","avatar_url":"https://github.com/dkhamsing.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHubOAuthController\n\nSimple GitHub OAuth Controller for iOS\n\n[![Build Status](https://travis-ci.org/dkhamsing/GitHubOAuthController.svg?branch=master)](https://travis-ci.org/dkhamsing/GitHubOAuthController)\n[![Version](https://img.shields.io/cocoapods/v/GitHubOAuthController.svg?style=flat)](https://cocoapods.org/pods/GitHubOAuthController)\n[![License](https://img.shields.io/cocoapods/l/GitHubOAuthController.svg?style=flat)](http://cocoadocs.org/docsets/GitHubOAuthController)\n[![Platform](https://img.shields.io/cocoapods/p/GitHubOAuthController.svg?style=flat)](http://cocoadocs.org/docsets/GitHubOAuthController)\n\n\n![](Assets/demo.gif)\n\n# Installation\n\n## [CocoaPods](https://cocoapods.org/)\n\n``` ruby\nplatform :ios, '9.0'\npod 'GitHubOAuthController'\n```\n\n## Manual\n\nAdd the files in the GitHubOAuthController folder to your project.\n\n## Usage\n\n### OAuth with Safari View Controller\n\n- Set url scheme in `.plist`\n\n![plist](Assets/plist.png)\n\n```\n\t\u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n\t\u003carray\u003e\n\t\t\u003cdict\u003e\n\t\t\t\u003ckey\u003eCFBundleURLName\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.dkhamsing.GitHubOAuthDemo\u003c/string\u003e\n\t\t\t\u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n\t\t\t\u003carray\u003e\n\t\t\t\t\u003cstring\u003egithuboauthdemo\u003c/string\u003e\n\t\t\t\u003c/array\u003e\n\t\t\u003c/dict\u003e\n\t\u003c/array\u003e\n```\n- Set *Authorization callback URL* in GitHub app https://github.com/settings/developers, i.e. `githuboauthdemo://`\n\n``` objc\n// configure (get redirectUri from plist)\n[[GitHubOAuthController sharedInstance] configureForSafariViewControllerWithClientId:kClientId clientSecret:kClientSecret redirectUri:redirectUri scope:kScope];\n\n// show login\n[[GitHubOAuthController sharedInstance] presentOAuthSafariLoginFromController:self];\n\n// get access token\n- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary\u003cNSString *,id\u003e *)options {\n    NSString *source = options[UIApplicationOpenURLOptionsSourceApplicationKey];\n    if ([source isEqualToString:gh_safariViewService]) {        \n        [[GitHubOAuthController sharedInstance] handleOpenUrl:url options:options success:^(NSString *accessToken, NSDictionary *raw) {\n            NSLog(@\"oauth with safari view controller: retrieved access token: %@ \\nraw: %@\", accessToken, raw);\n        } failure:nil];        \n    };\n\n    return NO;\n}\n```\n\n### Traditional in app OAuth\n\n``` objc\n#import \"GitHubOAuthController.h\"\n\nGitHubOAuthController *oauthController = [[GitHubOAuthController alloc] initWithClientId:kClientId clientSecret:kClientSecret scope:kScope success:^(NSString *accessToken, NSDictionary *raw) {\n  NSLog(@\"access token: %@ \\nraw: %@\", accessToken, raw);\n} failure:nil];\n\n[oauthController showModalFromController:self];\n```\n\n# Demo\n\nGitHubOAuthController includes a demo project.\n\n# Thanks\n\nThis project was inspired by Caleb Davenport's [SimpleAuth](https://github.com/calebd/SimpleAuth).\n\n# Contact\n\n- [github.com/dkhamsing](https://github.com/dkhamsing)\n- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)\n\n# License\n\nGitHubOAuthController is available under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkhamsing%2Fgithuboauthcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkhamsing%2Fgithuboauthcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkhamsing%2Fgithuboauthcontroller/lists"}