Download the PHP package indielogin/client without Composer
On this page you can find all versions of the php package indielogin/client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package client
IndieLogin Client
This is a helper library to use with services like IndieLogin.com. That service provides an API that works very similar to the IndieAuth protocol, but can authenticate users with a number of different methods, including IndieAuth, email, PGP keys, GitHub and Twitter.
When users log in with this library, it will first check their website for an authorization endpoint and do an IndieAuth flow directly if found. Otherwise, it will redirect them to the configured server to authenticate there.
Usage
Create a Login Form
You'll first need to create a login form to prompt the user to enter their website address. This might look something like the HTML below.
Begin the Login Flow
In the login.php
file, you'll need to initialize the session, and tell this library to discover the user's endpoints. If everything succeeds, the library will return a URL that you can use to redirect the user to begin the flow.
The example below will have some really basic error handling, which you'll probably want to replace with something nicer looking.
Example login.php
file:
The following scopes have special meaning to the authorization server and will request the user's full profile info instead of just verifying their profile URL:
profile
email
Handling the Redirect
In your redirect file, you just need to pass all the query string parameters to the library and it will take care of things! It will use the authorization or token endpoint it found in the initial step, and will use the authorization code to verify the profile information.
The result will be the response from the authorization endpoint, which will contain the user's final me
URL as well as profile info if you requested one or more scopes.
If there were any problems, the error information will be returned to you as well.
The library takes care of verifying the final returned profile URL has the same authorization endpoint as the entered URL.
Example redirect.php
file:
License
Copyright 2013-2020 by Aaron Parecki and contributors
Available under the MIT and Apache 2.0 licenses. See LICENSE.txt