# LightOpenID Quick Start ## Sign-on with OpenID is a two step process: 1. Step one is authentication with the provider: ```php $openid = new LightOpenID('my-host.example.org'); $openid->identity = 'ID supplied by the user'; header('Location: ' . $openid->authUrl()); ``` The provider then sends various parameters via GET, one of which is `openid_mode`. 2. Step two is verification: ```php $openid = new LightOpenID('my-host.example.org'); if ($openid->mode) { echo $openid->validate() ? 'Logged in.' : 'Failed!'; } ``` ### Notes: Change 'my-host.example.org' to your domain name. Do NOT use `$_SERVER['HTTP_HOST']` for that, unless you know what you're doing. Optionally, you can set `$returnUrl` and `$realm` (or `$trustRoot`, which is an alias). The default values for those are: ```php $openid->realm = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; $openid->returnUrl = $openid->realm . $_SERVER['REQUEST_URI']; ``` If you don't know their meaning, refer to any OpenID tutorial, or specification. ## Basic configuration options:
name | description |
---|---|
identity | Sets (or gets) the identity supplied by an user. Set it before calling authUrl(), and get after validate(). |
returnUrl | Users will be redirected to this url after they complete authentication with their provider. Default: current url. |
realm | The realm user is signing into. Providers usually say "You are sgning into $realm". Must be in the same domain as returnUrl. Usually, this should be the host part of your site's url. And that's the default. |
required and optional | Attempts to fetch more information about an user. See Common AX attributes. |
verify_peer | When using https, attempts to verify peer's certificate. See CURLOPT_SSL_VERIFYPEER. |
cainfo and capath | When verify_peer is true, sets the CA info file and directory. See CURLOPT_SSL_CAINFO and CURLOPT_SSL_CAPATH. |