{"id":19319698,"url":"https://github.com/hyperoslo/ohmyauth","last_synced_at":"2025-04-22T17:32:04.741Z","repository":{"id":56921190,"uuid":"50991846","full_name":"hyperoslo/OhMyAuth","owner":"hyperoslo","description":":closed_lock_with_key: Simple OAuth2 library with a support of multiple services.","archived":false,"fork":false,"pushed_at":"2018-09-27T08:54:07.000Z","size":182,"stargazers_count":66,"open_issues_count":0,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-02T02:22:28.563Z","etag":null,"topics":["ios","keychain","mac","oauth","swift","token"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperoslo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-03T10:19:11.000Z","updated_at":"2023-04-23T13:46:35.000Z","dependencies_parsed_at":"2022-08-20T21:50:29.118Z","dependency_job_id":null,"html_url":"https://github.com/hyperoslo/OhMyAuth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FOhMyAuth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FOhMyAuth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FOhMyAuth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FOhMyAuth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperoslo","download_url":"https://codeload.github.com/hyperoslo/OhMyAuth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287672,"owners_count":21405658,"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":["ios","keychain","mac","oauth","swift","token"],"created_at":"2024-11-10T01:24:52.036Z","updated_at":"2025-04-22T17:32:04.401Z","avatar_url":"https://github.com/hyperoslo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OhMyAuth\n\n⚠️ DEPRECATED, NO LONGER MAINTAINED\n\n[![CI Status](https://circleci.com/gh/hyperoslo/OhMyAuth.png)](https://circleci.com/gh/hyperoslo/OhMyAuth)\n[![Version](https://img.shields.io/cocoapods/v/OhMyAuth.svg?style=flat)](http://cocoadocs.org/docsets/OhMyAuth)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/OhMyAuth.svg?style=flat)](http://cocoadocs.org/docsets/OhMyAuth)\n[![Platform](https://img.shields.io/cocoapods/p/OhMyAuth.svg?style=flat)](http://cocoadocs.org/docsets/OhMyAuth)\n\n## Description\n\nSimple `OAuth2` library with a support of multiple services.\n\n## Usage\n\n- Setup:\n```swift\nlet config = AuthConfig(\n  clientId: \"client-id\",\n  accessTokenUrl: NSURL(string: \"access-token-url\")!,\n  accessGrantType: \"authorization_code\",\n  authorizeURL: NSURL(string: \"authorise-url\")!,\n  changeUserURL: NSURL(string: \"change-user-url\")!,\n  redirectURI: \"yourapp://auth\")\n\nconfig.extraAccessTokenParameters = [\"resource\": \"resource\"]\nconfig.extraRefreshTokenParameters = [\"resource\": \"resource\"]\n\nlet service = AuthService(name: \"service\", config: config)\nAuthContainer.addService(service)\n```\n\n- Safari app will be opened by default for authorization, if it's iOS9 and you'd\nlike to use `SFSafariViewController`, there is a ready-to-use class for you:\n```swift\n// SFSafariViewController will be presented on top of provided controller\nservice.config.webView = SafariWebView(viewController: viewController)\n```\n\n- Show a login web page:\n```swift\nAuthContainer.serviceNamed(\"service\")?.authorize()\n```\n\n- Handle response. If you use `SafariWebView` it will be dismissed ***automagically***:\n```swift\nfunc application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -\u003e Bool {\n   AuthContainer.serviceNamed(\"service\")?.accessToken(URL: url) { accessToken, error in\n      if let accessToken = accessToken where error == nil {\n         // User is logged in!!!\n      }\n   }\n}\n```\n\n- Get an access token to include it in the each request. If token is about to\nexpire it will be refreshed ***automagically***, so you always get an active\ntoken is the completion closure:\n```swift\nAuthContainer.serviceNamed(\"service\")?.accessToken(completion)\n```\n\n- If you need to change user and have a separate URL for that:\n```swift\nAuthContainer.serviceNamed(\"service\")?.changeUser()\n```\n\n- If you don't have authorisation by code, but by username and password,\nthere is a flow:\n```swift\nlet config = AuthConfig(\n  clientId: \"client-id\",\n  accessTokenUrl: NSURL(string: \"access-token-url\")!,\n  accessGrantType: \"password\")\n\nlet service = AuthService(name: \"service\", config: config)\nAuthContainer.addService(service)\n\nlet parameters = [\"username\": \"weirdo\", \"password\": \"123456\"]\nservice.accessToken(parameters: parameters) { accessToken, error in\n // Ready!\n}\n```\n\n- If you need to get your tokens, expiry date, username, user UPN:\n```swift\nlet accessToken = AuthContainer.serviceNamed(\"service\")?.locker.accessToken\nlet userUPN = AuthContainer.serviceNamed(\"service\")?.locker.userUPN\n```\n\nAnd yeah, you could add as many auth services as you want if you have some\ncrazy setup in the app. Just register a new one with a different name:\n```swift\nlet service = AuthService(name: \"another-service\", config: config)\n```\n\n## Author\n\nHyper Interaktiv AS, ios@hyper.no\n\n## Installation\n\n**OhMyAuth** is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'OhMyAuth'\n```\n\n**OhMyAuth** is also available through [Carthage](https://github.com/Carthage/Carthage).\nTo install just write into your Cartfile:\n\n```ruby\ngithub \"hyperoslo/OhMyAuth\"\n```\n\n## Author\n\nHyper Interaktiv AS, ios@hyper.no\n\n## Contributing\n\nWe would love you to contribute to **OhMyAuth**, check the [CONTRIBUTING](https://github.com/hyperoslo/OhMyAuth/blob/master/CONTRIBUTING.md) file for more info.\n\n## License\n\n**OhMyAuth** is available under the MIT license. See the [LICENSE](https://github.com/hyperoslo/OhMyAuth/blob/master/LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperoslo%2Fohmyauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperoslo%2Fohmyauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperoslo%2Fohmyauth/lists"}