https://github.com/jonathandey/oc-jd-dingoapi
Dingo/API implementation for OctoberCMS
https://github.com/jonathandey/oc-jd-dingoapi
api authentication dingo-api jwt octobercms octobercms-plugin
Last synced: about 1 month ago
JSON representation
Dingo/API implementation for OctoberCMS
- Host: GitHub
- URL: https://github.com/jonathandey/oc-jd-dingoapi
- Owner: jonathandey
- License: mit
- Created: 2016-12-09T13:58:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-03T17:36:51.000Z (about 5 years ago)
- Last Synced: 2025-04-06T03:06:26.254Z (2 months ago)
- Topics: api, authentication, dingo-api, jwt, octobercms, octobercms-plugin
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 16
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Implementation of the [Dingo/Api](https://github.com/dingo/api) for OcotberCMS
## Setup
Add the following env variables
```
API_PREFIX=api
API_SUBTYPE=YOUR_SUBTYPE
API_DEBUG=true
JWT_TTL=31622400
JWT_BLACKLIST_ENABLED=false
API_DEFAULT_FORMAT=json
```## Testing
First get a token
```
curl -X "POST" "http://127.0.0.1:8000/api/auth/token" \
-H 'Accept: application/x.YOUR_SUBTYPE.v1+json' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
```Then using the token
```
curl "http://127.0.0.1:8000/api/user/details" \
-H 'Accept: application/x.YOUR_SUBTYPE.v1+json' \
-H 'Authorization: Bearer TOKEN_FROM_FIRST_REQUEST'```
### Common problems
#### Routes not working?
Ensure you require your API routes.php file within your Plugin.php boot method. Example: `require realpath(__DIR__ . '/http/api/routes.php');`