Giter Site home page Giter Site logo

edenspiekermann / craft-jwt-auth Goto Github PK

View Code? Open in Web Editor NEW
5.0 6.0 16.0 99 KB

Enable authentication to Craft through the use of Javascript Web Tokens (JWT)

License: MIT License

PHP 95.54% HTML 4.46%
craftcms craft-plugin craft3 craft-cms jwt jwt-authentication php

craft-jwt-auth's People

Contributors

monachilada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

craft-jwt-auth's Issues

Craft JWT-auth use with CraftCMSπŸ€” ...

Hello!
I would like to know how to use the plugin in order to generate a token and use it with my database in order to get some info from it, please I would some help. Right now I have a nodejs/express server using const jwt = require("jsonwebtoken");.

Thank you in advance.

🐞 Local server = crash on start

Describe the bug
When I re-serve my Craft app, I get this error:

$ ./craft serve 
Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: craft\console\Request::headers'

in /path/to/craft/vendor/yiisoft/yii2/base/Component.php:154

Stack trace:
#0 /path/to/craft/vendor/edenspiekermann/craft-jwt-auth/src/services/JWT.php(40): yii\base\Component->__get('headers')
#1 /path/to/craft/vendor/edenspiekermann/craft-jwt-auth/src/CraftJwtAuth.php(62): edenspiekermann\craftjwtauth\services\JWT->getJWTFromRequest()
#2 [internal function]: edenspiekermann\craftjwtauth\CraftJwtAuth->edenspiekermann\craftjwtauth\{closure}(Object(yii\base\Event))
#3 /path/to/craft/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(yii\base\Event))
#4 /path/to/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1360): yii\base\Component->trigger('init')
#5 /path/to/craft/vendor/craftcms/cms/src/console/Application.php(65): craft\console\Application->_postInit()
#6 /path/to/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#7 /path/to/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#8 /path/to/craft/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#9 /path/to/craft/vendor/craftcms/cms/src/console/Application.php(54): yii\console\Application->__construct(Array)
#10 [internal function]: craft\console\Application->__construct(Array)
#11 /path/to/craft/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)
#12 /path/to/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\console\\A...', Array, Array)
#13 /path/to/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\console\\A...', Array, Array)
#14 /path/to/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(244): yii\BaseYii::createObject(Array)
#15 /path/to/craft/vendor/craftcms/cms/bootstrap/console.php(34): require('/Volumes/BLUE/P...')
#16 /path/to/craft/craft(21): require('/Volumes/BLUE/P...')
#17 {main}

To Reproduce
Steps to reproduce the behavior:

  1. Local serve (./craft serve)
  2. Go on Plugin Store, install the plugin
  3. Works fine (at least for now)
  4. Stop the server (Ctrl+C)
  5. Restart the server (./craft serve)
  6. Get this error. Did not serve...

Expected behavior
Craft running on serve.

Desktop (please complete the following information):

  • OS: MacOS Catalina
  • Craft: 3.3.11 Pro (trial)
  • Other plugins: oEmbed, Redactor, Amazon S3

Log in to Craft using JWT?

Hey is it possible to log in to craft using this plugin?

I am using NuxtJS and I would like to call an endpoint to log a user in and get a JWT back that I can use to make certain routes private in my app.

Many Thanks

πŸš€ Ability to change what header it reads the JWT from

It would be great if the Authorization header was an option that could be overwritten.

I found your plugin while researching ways to secure and streamline the Craft CP. We use Cloudflare and they offer a feature called Access that handles SSO at the edge, and once authorized makes the backend request with the header Cf-Access-Jwt-Assertion. I think this would just "work" if the header this plugin checks was configurable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.