{"id":13669352,"url":"https://github.com/ipunkt/social-auth","last_synced_at":"2025-04-01T09:53:09.907Z","repository":{"id":20770107,"uuid":"24054850","full_name":"ipunkt/social-auth","owner":"ipunkt","description":"social-auth uses laravel 4.* to wrap around an oauth library to provide 3rd party auth simply by adding their credentials to your config","archived":false,"fork":false,"pushed_at":"2015-01-13T14:33:00.000Z","size":438,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-07T05:27:32.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/ipunkt.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":"2014-09-15T12:04:50.000Z","updated_at":"2015-01-13T14:33:01.000Z","dependencies_parsed_at":"2022-09-01T01:22:05.670Z","dependency_job_id":null,"html_url":"https://github.com/ipunkt/social-auth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fsocial-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fsocial-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fsocial-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fsocial-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipunkt","download_url":"https://codeload.github.com/ipunkt/social-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246620237,"owners_count":20806721,"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-08-02T08:01:10.808Z","updated_at":"2025-04-01T09:53:09.887Z","avatar_url":"https://github.com/ipunkt.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"ipunkt/social-auth\n============\n\nSocial-Auth is a Laravel package which wraps around a oauth library and laravel with the goal to let you simply\nset the provider credentials and be done.\n\nIt currently uses hybrid_auth in the background.\nWith the coming of the new SocialLite package for laravel i will probably switch out hybrid_auth for it.\n\n\n# Install\n\n## Installation\n\nAdd the following lines to your composer.json:\n\n    \"require\": {\n        \"ipunkt/social-auth\": \"dev-master\"\n    }\n\n## Configuration\n\nTo configure 3 steps are necessary.  \nIf you wish for user deletes to trigger deletion of their mappings to provider accounts make sure to set the\n'user table' variable in the config before migrating\n\n### Add the service provider\nAdd \n\n    'Ipunkt\\SocialAuth\\SocialAuthServiceProvider'\n\n\nto your app.php\n\n### Publish and set your config\n\nPublish\n\n    php artisan config:publish ipunkt/social-auth\n\nthen set your provider credentials in\n\n    app/config/packages/ipunkt/social-auth/config.php\n\n### Migrate\nMigrate the necessary database tables.\n\n    php artisan migrate --package=\"ipunkt/social-auth\"\n    \n## Use\n\n### Error and Message Handling\nThis package tries not to bring any views of its own, thus error handling is done through the session.\nOn success, 'message' will be set directly in the Session. e.g. `{{ Session::get('message') }}`\nOn error, 'message' will be set in errors. e.g. {{ $errors-\u003efirst('message') }}\n\n### Authenticating with SocialAuth\n\n#### Login\n\nLetting your users log in through a SocialAuth provider is as simple as directing them to the `social.login` route with\nthe name of the provider as parameter.\n```blade\n{{ link_to_route('social.login', 'log in through Facebook',  'Facebook' }}\n```\n\n#### Attaching a Provider \n\n#### Registering\n\nAllowing your users to register using a provider account requires a little more work.  \n\n- First, make sure the 'register route' variable is set correctly in your config file.  \n- Provide the user a link to the `social.register` route, with the provider name as its parameter. e.g.\n    `{{ link_to_route('social.register', 'register through Facebook', ['Facebook']) }}`\n- If the user successfully logs into the provider they will be redirected back to your registration process. There you\n    can access their account data through SocialAuth::getRegistration()\n- If the registration process finishes successfuly, call SocialAuth::getRegistration()-\u003esuccess($newlyCreatedUser) to\n    create the connection between the local and provider account.\n\n#### Links to all enabled Providers\nMost of the time you will want to provide links to all enabled providers instead of a certain one.  \nTo do this, use `SocialAuth::getProviders()` to grab all enabled providers and use *Link($innerHtml) to have it build a link\nfor you.  \n\n- ProviderInterface::loginLink($innerHtml)\n- ProviderInterface::attachLink($innerHtml)\n- ProviderInterface::registerLink($innerHtml)\n\nExample:\n\n```blade\n@foreach(SocialAuth::getProviders() as $provider)\n    if(Auth::check()) {\n        // A link which lets you attach a user from this provider to your local account\n        {{ $provider-\u003eattachLink($provider-\u003egetName()) }}\n    } else {\n        // A link which lets you login through this provider\n        {{ $provider-\u003eloginLink($provider-\u003egetName()) }}\n    \n        // A link which lets a user request a running registration to use an account on this provider to login\n        {{ $provider-\u003eregisterLink($provider-\u003egetName()) }}\n    }\n@endforeach\n```\n\n#### Profile\nThe Profile is currently dependant on Hybrid_Auth_Profile as the underlying package\n\nProfileInterface  \n\nFunction            | returned value\n------------------- | --------------\ngetIdentifier\t    | The unique identifier string by which the provider identifies the user\ngetProfileUrl\t    | Profile URL\ngetWebsiteUrl\t    | Website URL\ngetPhotoUrl\t        | Photo URL\ngetDisplayName\t    | Display name or \"$firstName $lastName\"\ngetDescription\t    | \ngetFirstName\t    | First name\ngetLastName\t        | Last name\ngetGender\t        | Gender\ngetLanguage\t        | Language\ngetAge\t            | Age\ngetBirthDay\t        | Day of Birth\ngetBirthMonth\t    | Month of Birth\ngetBirthYear\t    | Year of Birth\ngetEmail\t        | Email\ngetVerifiedEmail\t| Verified Email if the provider allows it\ngetPhone\t        | Phone number\ngetAddress\t        | Address\ngetCountry\t        | Country\ngetRegion\t        | Region\ngetCity\t            | City\ngetZip\t            | ZIP or Postal code\n\nThere are 3 Ways to access Profiles:\n\n- Through the providers  \n    `SocialAuth::getProviders()['Facebook']-\u003egetProfile()`  \n    This will give you the currently logged in Users Profile on the given Provider. If the User is not currently logged\n    in through this Provider then the values stored in the Database will be returned.\n- Through `SocialAuth::getProfile`\n    This will give you the Profile of the currently logged in User with the special 'UserProfile' Provider. It contains the\n    same data as the first Provider Profile to be registered or attached to this user.\n- Through the UserModel implementing HasProfileInterface\n    implementing HasProfileInterface will allow you to manage profiles not just for the active user but all users in your database.\n    A default implementation using Eloquent is available through the `EloquentHasProfile` trait\n\n### Return Url\nYour provider will ask you to set a return url where user logging into your application get sent.\nThis is static: http://path.to/your/laravel/installation/social/auth\n\n## Advanced Use\n\n### Use your own ORM\n\nTo switch out Eloquent for the ORM of your choice do the following\n\n1.\nCreate a model which implements the SocialLoginInterface\nCreate a repository which implements the SocialLoginrepository interface\n\nbind this repository to 'Ipunkt\\SocialAuth\\SocialLoginInterface' in the Laravel IoC\n\n2.\nCreate a repository which implements the UserRepository interface\n\nbind this repository to 'Ipunkt\\SocialAuth\\Repositories\\UserRepository' in the Laravel IoC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipunkt%2Fsocial-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipunkt%2Fsocial-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipunkt%2Fsocial-auth/lists"}