1.0.18 • Published 6 months ago
simple-strapi-auth v1.0.18
Strapi plugin simple-strapi-auth
Working on Strapi version: v4..
First Setup
- Install as an npm dependency
# install dependencies
npm install simple-strapi-auth
- Check the below api's to generate token and refresh token
# Access token generation CURL
curl --location 'http://localhost:1337/simple-auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic bXlDbGllbnRJZDpteUNsaWVudFNlY3JldA==' \
--data-urlencode 'grant_type=client_credentials'
# Refresh Token generation Curl
curl --location 'http://localhost:1337/simple-auth/refresh-token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer b323177e47a266abc2d5d9cd42c08dcccdb9e365' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id=myClientId1' \
--data-urlencode 'client_secret=myClientSecret' \
--data-urlencode 'refresh_token=b323177e47a266abc2d5d9cd42c08dcccdb9e365'
# Static Builds API call
curl --location --globoff 'http://localhost:1337/api/countries' \
--header 'x-csrf-token: randomCSRFToken' \
--header 'Authorization: Bearer randomCSRFToken'
Note
- Please replace appropriate token and Basic auth values to generate access token.
For nextJS static builds, use x-csrf-token in header and same token to be sent in the authorisation header which will be generated using a secret key from .env file
X_CSRF_SECRET = "randomString"
Features
- Currently only designed to prevent unauthorized access to strapi public apis
- Works entirely on the principle of OAuth Client Credentials.
References
1.0.18
6 months ago
1.0.17
11 months ago
1.0.16
12 months ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.11
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.10
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago