Download the PHP package simgroep/oauth1-service without Composer

On this page you can find all versions of the php package simgroep/oauth1-service. 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 oauth1-service

Build Status

OAuth 1 Service

This library can be added to an application that wishes to validate their clients' requests with OAuth.

Installation

Just use Composer:

"require": {
    "simgroep/oauth1-service": "1.*"
}

Or just clone the repository and include/autoload everything yourself. But why would you?

Usage

There is a runner.php that serves as an example of usage. In the simplest way, use it like this:

You will need to know two things in your application: is the request valid, and who is sending the request if it's actually valid?

The first question is answered by isValidRequest(). It takes a Request object as a parameter, which can be one of several supplied classes:

Next, the Service takes two Token Providers. They are classes that you need to implement yourself: they determine which consumerTokens and accessTokens are valid. Implement them in any way you like; as long as the classes you create implement the TokenProviderInterface, you're fine. Its getSecret() method should be used to take the token, look it up somewhere (in a database, through some service, from an array of values, whatever you want) and return its secret.

When you don't need an accessToken to be included in the request, you can omit the TokenProvider and let the Service know that an accessToken is not required:

You can also include the TokenProvider and use this call: the token will then be optional. (The token will be validated when included, and ignored when not included.)

When the request is invalid, you can find out what is wrong by looking at getError().

When the request is valid, you can fetch the required data from getDetails(). Currently, it returns the two tokens used in the request.

There is a working example in the /examples folder.

The 'Authorization' header

The code depends on having the 'Authorization' header available in your PHP context. However, when using Apache, this header is not always available. When using mod_rewrite, the following rule can help with making sure the variable $_SERVER['HTTP_AUTHORIZATION'] is set:

When mod_rewrite is not available, or your .htaccess is too restricted, you might be able to work something out using the apache_request_headers() function.


All versions of oauth1-service with dependencies

PHP Build Version
Package Version
No informations.
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 simgroep/oauth1-service contains the following files

Loading the files please wait ....