{"id":23413117,"url":"https://github.com/claudiob/yt-auth","last_synced_at":"2025-10-12T05:31:24.116Z","repository":{"id":56899195,"uuid":"84380029","full_name":"claudiob/yt-auth","owner":"claudiob","description":"Authenticate users with their Google account","archived":false,"fork":false,"pushed_at":"2024-12-11T00:45:27.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-13T04:52:26.674Z","etag":null,"topics":["authentication","gem","google","oauth2","rails","youtube"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/claudiob.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":"2017-03-09T00:33:27.000Z","updated_at":"2024-12-11T00:45:21.000Z","dependencies_parsed_at":"2024-12-11T01:30:38.709Z","dependency_job_id":"b1eda736-71b5-422f-b115-84664101c625","html_url":"https://github.com/claudiob/yt-auth","commit_stats":null,"previous_names":["fullscreen/yt-auth","claudiob/yt-auth","nullscreen/yt-auth"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/claudiob/yt-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claudiob%2Fyt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claudiob%2Fyt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claudiob%2Fyt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claudiob%2Fyt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claudiob","download_url":"https://codeload.github.com/claudiob/yt-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claudiob%2Fyt-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002400,"owners_count":26083374,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["authentication","gem","google","oauth2","rails","youtube"],"created_at":"2024-12-22T18:56:29.788Z","updated_at":"2025-10-12T05:31:23.841Z","avatar_url":"https://github.com/claudiob.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Authenticate users with their Google account\n============================================\n\nYt::Auth lets you easily authenticate users of your website by means of\ntheir Google-based email address.\n\nWith Yt::Auth, it is easy to limit access to your app to a few users without\nthe need for them to create a username and password.\n\nThe **source code** is available on [GitHub](https://github.com/claudiob/yt-auth) and the **documentation** on [RubyDoc](http://www.rubydoc.info/gems/yt-auth/frames).\n\n[![Build Status](http://img.shields.io/travis/claudiob/yt-auth/master.svg)](https://travis-ci.org/claudiob/yt-auth)\n[![Coverage Status](http://img.shields.io/coveralls/claudiob/yt-auth/master.svg)](https://coveralls.io/r/claudiob/yt-auth)\n[![Dependency Status](http://img.shields.io/gemnasium/claudiob/yt-auth.svg)](https://gemnasium.com/claudiob/yt-auth)\n[![Code Climate](http://img.shields.io/codeclimate/github/claudiob/yt-auth.svg)](https://codeclimate.com/github/claudiob/yt-auth)\n[![Online docs](http://img.shields.io/badge/docs-✓-green.svg)](http://www.rubydoc.info/gems/yt-auth/frames)\n[![Gem Version](http://img.shields.io/gem/v/yt-auth.svg)](http://rubygems.org/gems/yt-auth)\n\nYt::Auth.url_for\n----------------\n\nWith the `url_for` class method, you can obtain a URL where to redirect users\nwho need to authenticate with their Google account in order to use your\napplication:\n\n```ruby\nredirect_uri = 'https://example.com/auth' # REPLACE WITH REAL ONE\nscope = %i(yt-analytics.readonly youtube)\nYt::Auth.url_for(redirect_uri: redirect_uri, scope: scope, force: true)\n # =\u003e https://accounts.google.com/o/oauth2/auth?client_id=...\u0026scope=email\u0026redirect_uri=https%3A%2F%2Fexample.com%2Fauth\u0026response_type=code\n```\n\nYt::Auth.create\n----------------\n\nAfter users have authenticated with their Google account, they will be\nredirected to the `redirect_uri` you indicated, with an extra `code` query\nparameter, e.g. `https://example.com/auth?code=1234`\n\nWith the `create` class method, you can create an instance for that\nauthentication:\n\n```ruby\nredirect_uri = 'https://example.com/auth' # REPLACE WITH REAL ONE\ncode = 'dfwe7r9djd234ffdjf3009dfknfd98re' # REPLACE WITH REAL ONE\nauth = Yt::Auth.create(redirect_uri: redirect_uri, code: code)\n # =\u003e #\u003cYt::Auth:0x007fe61d…\u003e\n```\n\nYt::Auth#email\n--------------\n\nOnce you have an instance of `Yt::Auth`, you can obtain the verified email\nof the authenticated user:\n\n```ruby\nauth.email\n # =\u003e \"user@example.com\"\n```\n\nYt::Auth#access_token\n---------------------\n\nOnce you have an instance of `Yt::Auth`, you can also obtain the access token\nof the authenticated user:\n\n```ruby\nauth.access_token\n # =\u003e \"ya29.df8er8e9r89er\"\n```\n\nYt::Auth#refresh_token\n----------------------\n\nOnce you have an instance of `Yt::Auth`, you can also obtain the refresh token\nof the authenticated user:\n\n```ruby\nauth.refresh_token\n # =\u003e \"sdf7f7erre98df\"\n```\n\nYt::Auth.find_by\n----------------\n\nIf you already know the refresh token of a Google account, you can obtain its\ncomplete authentication object:\n\n```ruby\nauth = Auth.find_by(refresh_token: \"sdf7f7erre98df\")\nauth.email\n # =\u003e \"user@example.com\"\n```\n\n\nYt::HTTPError\n-------------\n\n`Yt::HTTPError` will be raised whenever something goes wrong during the\nauthentication process. The message of the error will include the details:\n\n```ruby\nredirect_uri = 'https://example.com/auth' # REPLACE WITH REAL ONE\ncode = 'this-is-not-a-valid-code'\nYt::Auth.new(redirect_uri: redirect_uri, code: code).email\n # =\u003e Yt::HTTPError: Invalid authorization code.\n```\n\nHow to contribute\n=================\n\nContribute to the code by forking the project, adding the missing code,\nwriting the appropriate tests and submitting a pull request.\n\nTo run the tests correctly, set up the environment variables `YT_ACCOUNT_CLIENT_ID`\nand `YT_ACCOUNT_CLIENT_SECRET` with the credentials of an existing Google OAuth app.\n\nIn order for a PR to be approved, all the tests need to pass and all the public\nmethods need to be documented and listed in the guides. Remember:\n\n- to run all tests locally: `bundle exec rspec`\n- to generate the docs locally: `bundle exec yard`\n- to list undocumented methods: `bundle exec yard stats --list-undoc`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaudiob%2Fyt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaudiob%2Fyt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaudiob%2Fyt-auth/lists"}