Passport for mobile apps with Secret key confusion
Do you need to use client_secret for mobile apps using passport?
Goal: I'm trying to use Passport to provide tokens for mobile apps.
I went through the Laravel docs on Passport and with Passport password grant you are supposed to send a client_secret. However, on this page (https://www.oauth.com/oauth2-servers/client-registration/client-id-secret/) they are saying "and only issue a secret for “web server” apps". So, is Laravel docs indicating that we should send client secret with mobile apps?
@aklearn No, you shouldn’t be passing a secret key in HTTP request. The clue’s in the name: it should be secret. The fact that the password grant requires you to pass the client secret when requesting a token is one of the reasons it‘s flat-out disallowed in the OAuth’s latest security best practice:
The Authorization Code grant with "Proof Key for Code Exchange" (PKCE) is a secure way to authenticate single page applications or native applications to access your API.
@martinbean
Thanks for pointing out PKCE. I looked at the docs and am not clear on how to use that. Do you have any links that explain this a little further?
Currently have created my own login API which creates the token via
$user->createToken('Laravel Password Grant Client')->accessToken;
I get the feeling this isn't the professional/recommended way. Can you please share some information about this?
Currently have created my own login API which creates the token via $user->createToken('Laravel Password Grant Client')->accessToken;
@aklearn So you’re using Passport, but then not using Passport?
Passport is an OAuth server implementation. You request OAuth tokens from the /oauth/token endpoint Passport registers. You don’t build your own controllers that then just manually creates and returns tokens, otherwise you may as well not use Passport.