Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie not created automatically #760

Closed
RalpinMcDjango opened this issue Jun 7, 2020 · 5 comments
Closed

Cookie not created automatically #760

RalpinMcDjango opened this issue Jun 7, 2020 · 5 comments

Comments

@RalpinMcDjango
Copy link
Contributor

RalpinMcDjango commented Jun 7, 2020

Hi guys,

As i understand since #753 the bundle should automatically return a secure and httpOnly cookie with the name provided in the config YAML.

This doesn't appear to be working on my environment right now. I'm testing this via Postman using Symfony 5 as the framework.

lexik_jwt_authenctication.yaml

token extraction settings

token_extractors:
    cookie:
        enabled: true
        name: Bearer
    authorization_header:
        enabled: false
        prefix:  Bearer
        name:    Authorization
    query_parameter:
        enabled: false
        name:    bearer

Any ideas why this might not be working as expected?

@chalasr
Copy link
Collaborator

chalasr commented Jun 7, 2020

Hey,

For backward compatibility reasons, we can't enable the feature based on the configured extractor (since one could have a similar cookie-adding logic which could break when upgrading).

For enabling this feature, you need to set another config option:

token_extractors: 
    cookie: 
        enabled: true
        name: BEARER
# ...
set_cookies:
    BEARER: ~

# Full config with defaults:
#  BEARER:
#      lifetime: null (defaults to token ttl)
#      samesite: lax
#      path: /
#      domain: null (null means automatically set by symfony)

@chalasr
Copy link
Collaborator

chalasr commented Jun 7, 2020

If you don't mind, I'll keep this issue open as a reminder, we need to document the new option (PR welcome :) )

@RalpinMcDjango
Copy link
Contributor Author

Hey,

For backward compatibility reasons, we can't enable the feature based on the configured extractor (since one could have a similar cookie-adding logic which could break when upgrading).

For enabling this feature, you need to set another config option:

token_extractors: 
    cookie: 
        enabled: true
        name: BEARER
# ...
set_cookies:
    BEARER: ~

# Full config with defaults:
#  BEARER:
#      lifetime: null (defaults to token ttl)
#      samesite: lax
#      path: /
#      domain: null (null means automatically set by symfony)

That's perfect, thank you. I thought there might be some more configuration required.

If you don't mind, I'll keep this issue open as a reminder, we need to document the new option (PR welcome :) )

Not a problem at all :)

@RalpinMcDjango
Copy link
Contributor Author

PR submitted

@chalasr
Copy link
Collaborator

chalasr commented Jun 14, 2020

Fixed by #763, Thank you very much @RalpinMcDjango

@chalasr chalasr closed this as completed Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants