{"id":20348463,"url":"https://github.com/saadmairaj/oauthbrowser","last_synced_at":"2025-04-12T01:14:25.857Z","repository":{"id":57447537,"uuid":"260325517","full_name":"Saadmairaj/OAuthBrowser","owner":"Saadmairaj","description":"This module will let you authenticate OAuth 2.0 via the system browser and get the response URL. ","archived":false,"fork":false,"pushed_at":"2023-03-20T04:29:55.000Z","size":21,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T01:14:17.225Z","etag":null,"topics":["applescript","authentication","google","oauth2","osascript","scraping-python","url","webscraping"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Saadmairaj.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-04-30T21:49:18.000Z","updated_at":"2023-07-22T19:51:13.000Z","dependencies_parsed_at":"2024-11-15T01:02:58.301Z","dependency_job_id":null,"html_url":"https://github.com/Saadmairaj/OAuthBrowser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saadmairaj%2FOAuthBrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saadmairaj%2FOAuthBrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saadmairaj%2FOAuthBrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saadmairaj%2FOAuthBrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Saadmairaj","download_url":"https://codeload.github.com/Saadmairaj/OAuthBrowser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501861,"owners_count":21114684,"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":["applescript","authentication","google","oauth2","osascript","scraping-python","url","webscraping"],"created_at":"2024-11-14T22:20:31.083Z","updated_at":"2025-04-12T01:14:25.829Z","avatar_url":"https://github.com/Saadmairaj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuthBrowser\n\n[![PyPI](https://img.shields.io/pypi/v/OAuthBrowser)](https://pypi.org/project/oauthbrowser)\n[![Maintainability](https://api.codeclimate.com/v1/badges/5e6ea349636a097fdae1/maintainability)](https://codeclimate.com/github/Saadmairaj/OAuthBrowser/maintainability)\n[![Downloads](https://pepy.tech/badge/oauthbrowser)](https://pepy.tech/project/oauthbrowser)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FSaadmairaj%2FOAuthBrowser\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n\n\nThis module will let you authenticate [OAuth 2.0](https://oauth.net/2/) via system browser and get response URL. Currently supporting **Google Chrome** and **Safari** browsers. Built with *applescript* and [*osascript*](https://ss64.com/osx/osascript.html), only works on Mac OSX. \n\nA lot more can be done with **OAuthBrowser** like getting source code without getting automation detection from websites.\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install [OAuthBrowser](https://pypi.org/project/OAuthBrowser/).\n\n```bash\npip install OAuthBrowser\n```\n\nOr install the latest repo from here.\n\n```bash\npip install git+https://github.com/Saadmairaj/OAuthBrowser#egg=OAuthBrowser\n```\n\n## Usage\n\nUsage is very simple\n\n1. Pass authentication URL.\n2. Apply `Wait` class to wait for the browser to redirect.\n3. Fetch URL.\n4. Close browser.\n\n```python\nfrom OAuthBrowser import Safari, Wait\nfrom urllib.parse import urlparse, parse_qs\n\nURL = \"\"\"https://accounts.google.com/signin/oauth/oauthchooseaccount?\nscope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly\u0026\nstate=state_parameter_passthrough_value\u0026\nredirect_uri=https%3A%2F%2Foauth2.example.com%2Fcode\u0026\naccess_type=offline\u0026\nresponse_type=code\u0026\nclient_id=583306224539-atbcaa8ne8g85e8kc006o6vmq99qiid0.apps.googleusercontent.com\u0026\no2v=2\u0026as=CDdm3G6Zd1UOG9o_gWXzQQ\u0026flowName=GeneralOAuthFlow\"\"\"\n\n# Initialise browser\nbrowser = Safari(window_geometry=(100, 22, 400, 690))\n# Pass Authentication URL\nbrowser.open_new_window(URL)\n# Initialise Wait\nwait = Wait(browser)\n# Wait till query \"code\" is present in the URL.\nwait.until_present_query('code')\n# Fetch the url\nresponse_url = urlparse(browser.get_current_url())\ncode = parse_qs(response_url.query).get('code')[0]\nprint(\"\\nCode: %s\\n\" % code)\n# Close the browser\nbrowser.quit()\n```\n\n## Demonstration\n\n```bash\npython -m OAuthBrowser\n```\n\n## Contributing\n\nWhen contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method of this repository before making a change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\n[MIT](https://github.com/Saadmairaj/OAuthBrowser/blob/master/LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadmairaj%2Foauthbrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaadmairaj%2Foauthbrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadmairaj%2Foauthbrowser/lists"}