Download the PHP package webservco/discogs-auth without Composer
On this page you can find all versions of the php package webservco/discogs-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webservco/discogs-auth
More information about webservco/discogs-auth
Files in webservco/discogs-auth
Package discogs-auth
Short Description Discogs Authentication library written in PHP.
License MIT
Homepage https://github.com/webservco/discogs-auth
Informations about the package discogs-auth
webservco/discogs-auth
A PHP library for webservco/framework.
Builds the Authorization header for each Discogs authentication type: app key, personal access token and OAuth.
Note:
webservco/frameworkis considered legacy. It has been replaced by individual components, please see webservco/sandbox.
- Requires: PHP 8.3+,
webservco/framework(only for the exception base class) - Related:
webservco/discogs-api(takes anAuthInterfaceand sends its header with every request)
Installation
Usage
Pick the class that matches the access you need:
| Class | Constructor | Use |
|---|---|---|
Discogs\App |
consumer key, consumer secret | Database access as an app, no user. |
Discogs\User |
personal access token | Your own account. |
OAuth\RequestToken |
consumer key, consumer secret, callback URL | OAuth step 2: GET oauth/request_token. |
OAuth\AccessToken |
consumer key, consumer secret, request token, request token secret, verifier | OAuth step 4: POST oauth/access_token. |
OAuth\OAuth |
consumer key, consumer secret, access token, access token secret | Every request made on behalf of another user. |
Namespaces are relative to WebServCo\DiscogsAuth\.
OAuth flow
- Get a consumer key and secret by registering an app on Discogs.
- Call
oauth/request_tokenwithRequestToken. Keep the returnedoauth_tokenandoauth_token_secret. - Redirect the user to
https://discogs.com/oauth/authorize?oauth_token=.... Discogs redirects back to the callback URL withoauth_verifier, or withdeniedif the user refused. - Call
oauth/access_tokenwithAccessToken. Store the returned token and secret. - Use
OAuthwith the stored token and secret for every request after that, starting withoauth/identity.
The webservco/discogs-examples project has a page for each step.
Notes
The OAuth headers use the PLAINTEXT signature method, so only send them over HTTPS. Each call to getAuthHeader() creates a new nonce and timestamp.
For the "Invalid signature. Expected signature base string" error, see these Discogs forum threads: 730066, 704059.
Development
License
MIT