Passport: Larvel 5.3 Passport JWT Authentication

Created on 28 Dec 2016  路  4Comments  路  Source: laravel/passport

Hello

Earlier when I was using laravel 5.2, i used a third party package https://github.com/tymondesigns/jwt-auth/ for making JWT based authentication. Where we just had to pass the username and password to get a token.

Now in laravel 5.3 with the introduction of passport I want to make a JWT based authentication but passport requires me to specify the client_id and client_secret along with the username and password. which was not there in tymondesigns/jwt-auth.

If i dont make a request without the client_id then it throws an error http://pix.toile-libre.org/upload/original/1482908288.png but when I pass the client_id and client_secret then it works fine http://pix.toile-libre.org/upload/original/1482908143.png

How can I make a JWT request in laravel 5.3 and passport with just the username and password and without specifying client_id and client_secret.

Thanks in advance

Most helpful comment

@soubhikchatterjee Passport was created to follow the OAuth 2.0 Authorization Framework RFC. It is not a custom JWT library, it does use JWT for the access tokens however.

If you are looking for just authentication using JWT's, you're going to have to continue using tymon/jwt-auth.

If you are actually looking for OAuth with JWT's and not wanting to follow the client_id and client_secret flows, you could create your own OAuth grant for Passport using this package.

All 4 comments

@soubhikchatterjee Passport was created to follow the OAuth 2.0 Authorization Framework RFC. It is not a custom JWT library, it does use JWT for the access tokens however.

If you are looking for just authentication using JWT's, you're going to have to continue using tymon/jwt-auth.

If you are actually looking for OAuth with JWT's and not wanting to follow the client_id and client_secret flows, you could create your own OAuth grant for Passport using this package.

Finally, someone took initiative to create a package for Passport custom grant 馃憤

Thanks @craigpaul for referencing it here. :)

Thanks guys for your replies.

I have answered my own question here http://stackoverflow.com/questions/41376928/larvel-5-3-passport-jwt-authentication/41395074#41395074

@soubhikchatterjee Ah I see what you were getting at. That's not OAuth, but that's obviously not what you were after. Just as a heads up, using Passport like this is quite a bit of extra bloat for no reason, but if that is no big deal for you then that's all good. Please remember to close the issue since it has been resolved :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gbgelado picture gbgelado  路  3Comments

rudolfdobias picture rudolfdobias  路  3Comments

seriousjelly picture seriousjelly  路  3Comments

SwiTool picture SwiTool  路  3Comments

raksrivastava picture raksrivastava  路  3Comments