jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

Invalid Signature - JWT #78

Closed masterpowers closed 8 years ago

masterpowers commented 8 years ago

Hi Ive been Following Along A tutorial https://scotch.io/tutorials/token-based-authentication-for-angularjs-and-laravel-apps and http://ryanchenkie.com/token-based-authentication-for-angularjs-and-laravel-apps/ To implement JWT Authentication

Everything is Working Fine, When Posting Users email and Password http://rfnbeta.app:8000/api/authenticate/auth?email=iyuri305@gmail.com&password=secret

Also i Can Retrieve Authenticated User http://rfnbeta.app:8000/api/authenticate/user/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjUsImlzcyI6Imh0dHA6XC9cL3JmbmJldGEuYXBwOjgwMDBcL2FwaVwvYXV0aGVudGljYXRlXC9hdXRoIiwiaWF0IjoiMTQ0NDgyNDM4OCIsImV4cCI6IjE0NDQ4Mjc5ODgiLCJuYmYiOiIxNDQ0ODI0Mzg4IiwianRpIjoiMjVjMjA2MDMwZGRiMDhhNGRkNTcwZDg1OTBiOWE5ZDEifQ.uA9PObS1VQ5ku3ney4fNb0ocObOY9nD-XFMG0y80ePU

here is the result { "data": { "user": { "id": 5, "name": "", "email": "iyuri305@gmail.com", "created_at": "2015-10-14 07:25:45", "updated_at": "2015-10-14 07:25:45" } } }

But I get an Invalid Signature when i go to jwt.io http://imgur.com/dIRezZJ

I just Wanna Know The reason why Im Getting an Invalid Signature Is it Only Because Im only On Local Environment or Is there any Other Reason for this Looking For Answer thanks

jadjoubran commented 8 years ago

Hi @masterpowers This doesn't seem to be an issue with this package and unfortunately I don't know the answer..

We can keep this open for a few days, maybe someone else can contribute.

masterpowers commented 8 years ago

Yup Figured it out while watching tutorial i manage to make the Signature Verified by pasting the secret in jwt.php 'secret' => env('JWT_SECRET', 'abksynF8jShkqbXfllf9tcsAzdo4fOZV'), as shown in the picture. http://imgur.com/YpXqgWw

There is no issue at all having the invalid signature :)

Thanks for the Reply :+1:

jadjoubran commented 8 years ago

It's better to have this in your .env file You can generate one by running php artisan jwt:generate