DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: OAuth2 Server¶
Created: | 2010-02-18T17:33:18 |
---|---|
Changed by: | Robert Heel |
Changed: | 2010-11-08T11:07:53 |
Classification: | ods_oauth2_server |
Keywords: | oauth2, api, remote, server |
Author: | Robert Heel |
Email: | rheel@1drop.de |
Info 4: | |
Language: | en |
EXT: OAuth2 Server - ods_oauth2_server
EXT: OAuth2 Server¶
Extension Key: ods_oauth2_server
Language: en
Keywords: oauth2, api, remote, server
Copyright 2010, Robert Heel, <rheel@1drop.de>
Onedrop Solutions GmbH & Co. KG
Sudetenstraße 26
93073 Neutraubling
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.org
Table of Contents¶
`Introduction 3 <#__RefHeading__1493_1380477500>`_
`Administration 4 <#__RefHeading__1503_1380477500>`_
OAuth2 application management 4
`Configuration 6 <#__RefHeading__1507_1380477500>`_
`Known problems 7 <#__RefHeading__1515_1380477500>`_
`To-Do list 8 <#__RefHeading__1517_1380477500>`_
Introduction¶
What does it do?¶
- Provides an oauth2 authentication service for TYPO3
- OAuth2 server library from http://code.google.com/p/oauth2-php/
Screenshots¶
Administration¶
OAuth2 application management¶
Add an OAuth2 Server Client record to the root page of your TYPO3 installation:
Write an application¶
You can take a look at the extension “ods_pushbuddy_helper”, which uses this extension.
Create a class, e.g. tx_example_server in class.tx_example_server.php:
<?php
Class tx_example_server {
Function request($params, &$callingObj){
$callingObj->setContentFormat('plain');
$callingObj->addContent(1,'Hello World');
}
}
?>
Use a hook in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['remoteserver']['services']['example::module'] = 'EXT:example/class.tx_example_server.php:tx_example_server->request';
It's the same hook and syntax as the extension “remote_server” uses.
Connect to this application¶
Get an access code from ods_oauth2_server
GET: http://example.com/typo3/typo3conf/ext/ods_oauth2_server/api/au thorize.php
Parameters:
- client_id=...
- response_type=code
- redirect_uri=http://example.com/
Exchange the access code against an access token:
POST: http://example.com/typo3/typo3conf/ext/ods_oauth2_server/api/t oken.php
Parameters:
- code=...
- client_id=...
- grant_type=authorization-code
- redirect_uri= http://example.com/
Connect to your application
POST: http://example.com/typo3/typo3conf/ext/ods_oauth2_server/api/api.php
Parameters:
- oauth_token=...
- serviceID=example::module
TYPO3 only accept connection from known Browsers, please set an user agent, e.g.
curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla');