Passport: Suggestion: Make cookie name configurable

Created on 9 Aug 2017  路  3Comments  路  Source: laravel/passport

I was wondering if the cookie name which hard coded here (laravel_token in "vendor\laravel\passport\src\Passport.php") be made configurable so that we don't have to edit the framework code if we want to rename the cookie? An option like COOKIE_PREFIX coming from .env can be used to optionally build the cookie names.

PS: same comment applies to laravel framework (laravel_session cookie) as well.

Most helpful comment

I think the following do what you need

Passport::cookie('other_cookie_name');

All 3 comments

I think the following do what you need

Passport::cookie('other_cookie_name');

I think @brunogaspar 's answer was resolved this problem.
@mind-control If you want use .env file (environment variables), you can do:

Passport::cookie(config('auth.passport.cookie', env('PASSPORT_COOKIE', 'laravel_api')));

I noticed this is undocumented. I'll try to update the docs with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aluferraz picture aluferraz  路  3Comments

seriousjelly picture seriousjelly  路  3Comments

s4uron picture s4uron  路  3Comments

cookiejarblush picture cookiejarblush  路  4Comments

playerrtwo picture playerrtwo  路  4Comments