Download the PHP package polaris/social without Composer

On this page you can find all versions of the php package polaris/social. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package social

polaris/social

Social sign-in for Polaris for PHP: OAuth 2.0 and OpenID Connect through Google, Apple, Microsoft, GitHub and fifteen more providers, or any other OAuth 2 server; sign-up and sign-in ending in core's login envelope, account linking under a policy, Google One Tap, provider tokens on the user's behalf, and an OAuth proxy so preview and local origins sign in through the stable one registered at the providers.

polaris/audit is required and must be registered too: every sign-in, link and refusal is a social.* event in the audit store. baseUrl is where Polaris is mounted, prefix included: the callback each provider is configured with is baseUrl/social/<provider>/callback. The PSR-18 client and PSR-17 factories talk to the providers. In Laravel, Symfony and Yii the instance goes in the adapter's plugins configuration; the table (polaris_social_account) joins polaris:install, schema:create and schema:diff, the routes join the route table.

The sign-in

  1. The application calls POST /social/{provider}/start with, optionally, the redirect_uri the sign-in should end on (one of the plugin's; the first by default) and scopes. It answers {data: {url, state}}; the application sends the browser to url.
  2. The provider authenticates the user and sends the browser back to GET /social/{provider}/callback (POST for Apple's form_post). Polaris exchanges the code (PKCE where the provider takes it), reads the profile (the id_token verified against the provider's keys for an OpenID Connect provider), applies the linking policy and answers 302 <redirect_uri>?code=...&state=.... Tokens never travel in a URL; the application compares state with the one start answered before it exchanges the code, so a flow it did not start (someone else's) is dropped.
  3. The application calls POST /social/exchange with the code, once, within a minute, and receives the login envelope (amr: ["social:<provider>"]), or core's mfa_required ticket when the user has a confirmed MFA factor, to complete at /auth/mfa/verify.

The linking policy

Routes

Route Who Does
POST /social/{provider}/start {redirect_uri?, scopes?} public where to send the browser
GET\|POST /social/{provider}/callback public the provider's answer; 302 redirect_uri?code=
POST /social/exchange {code} public the login envelope or the linked account, once
POST /social/google/one-tap {credential} public the One Tap id_token, verified offline, for the envelope
GET /social/accounts bearer the caller's linked accounts (never their tokens)
POST /social/{provider}/link {redirect_uri?, scopes?} bearer, step_up where to send the browser to link
DELETE /social/{provider} bearer, step_up unlinks
POST /social/{provider}/token bearer, step_up {access_token, expires_at, scopes} for the provider's API, refreshed when expiring

Errors are problem documents: social/provider_not_found, social/redirect_not_allowed, social/state_invalid, social/provider_error (what the provider refused is in the audit trail), social/token_invalid, social/email_required, social/email_mismatch, social/account_exists, social/account_linked, social/account_disabled, social/email_unverified, social/not_linked, social/last_credential, social/code_invalid, social/no_refresh, social/invalid_input. The TypeScript client has every route as client.social.*.

Providers

The catalog: google, apple, microsoft, github, gitlab, discord, facebook, x, linkedin, slack, twitch, spotify, zoom, notion, dropbox, reddit, kick, tiktok, huggingface. Each is a Definition (endpoints, scopes, PKCE, OpenID Connect issuer, how its profile maps) behind one OAuth2Provider; Apple (the client secret is a JWT the plugin signs with the team key; the name arrives in the first callback only) and GitHub (the verified primary email from /user/emails) have their own classes. Microsoft takes tenant (common, organizations, consumers or a tenant id). A provider that shares no verified email (X without the approved field, Reddit, TikTok) cannot sign up by itself; it links from a session.

Any other OAuth 2 server, Better Auth's GenericOAuth:

The OAuth proxy

Providers want one registered callback. With proxy: 'https://auth.example.com', a deployment mounted elsewhere (a preview, http://localhost) sends the provider to the stable origin's callback and puts its own callback in the state, signed under core's pepper (which the deployments share through APP_KEY). The stable origin's callback forwards a validly signed state to the preview's callback with the code, and refuses a tampered or unsigned one (social/state_invalid); the preview completes the exchange itself.

Configuration

The state (ten minutes), the hand-off codes (a minute) and the providers' key sets (an hour) live in the graph's cache: share it across web nodes as you share core's rate store.

License

MIT. Polaris for PHP is created and maintained by 2am.tech.


All versions of social with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-openssl Version *
firebase/php-jwt Version ^7.0
polaris/audit Version ^0.12
polaris/core Version ^0.12
psr/clock Version ^1.0
psr/event-dispatcher Version ^1.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/simple-cache Version ^3.0
symfony/uid Version ^7.0 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package polaris/social contains the following files

Loading the files please wait ...