Lexik Bundle Symfony 3

Elisabeth

I use LexikAuthentication Bundle. When I try to make the UI using ajax for login_check, I get back the token in localStorage but when I try to login to my UI, I get 401 not authorization.

This is my login_check:

function authenticate(e) {
        e.preventDefault();
        $.ajax({
            url: 'http://localhost:8000/login_check',
            type: 'POST',
            data: JSON.stringify({
                '_username': $('#username').val(),
                '_password': $('#password').val()
            }),
            dataType: 'json',
            contentType: "application/json",
            access_token: "",
            crossDomain: true,
            success: function (data) {
                if (data != null && data != '') {
                    var token = "Bearer " + data.token;
                    console.log(token);
                    localStorage.setItem('token', data.token);
                    }
            }
        });

Anyone know how to fix this?

Elisabeth

Okay i found the solution by my self. The error was Here : localStorage.setItem('token', data.token); It should be like this : localStorage.setItem("Bearer " ,data.token);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Symfony 3: How to create a private bundle

From Dev

Unable to install bundle for Symfony 3 using Composer

From Dev

Sonata User Bundle + Symfony 3.x

From Dev

API Post to Sonata Media Bundle Symfony 3

From Dev

How to auto generate a bundle in Symfony3?

From Dev

Symfony 3 - Sonata Aplication Media Bundle error

From Dev

Unable to configure Symfony (3rd party) bundle

From Dev

Symfony 3 + FOS REST Bundle: Normalize values before validation

From Dev

Symfony3 - MISD Phone Number Bundle format

From Dev

What is wrong with my bundle extension class ( symfony 3 )?

From Dev

Symfony 3 - Ckeditor bundle : Unrecognized options "template, template_parameters"

From Dev

Extract the current namespace, bundle, controller and action name symfony3

From Dev

Symfony 3 overwrite FOS UserTemplate - but put the Views in my Bundle

From Dev

Symfony call a bundle in an other bundle

From Dev

Symfony Add Bundle

From Dev

Symfony solr bundle 2.8 +

From Dev

sonata admin bundle symfony

From Dev

New symfony bundle, when

From Dev

Symfony Add Bundle

From Dev

Reusing Entities on symfony bundle

From Dev

Symfony solr bundle 2.8 +

From Dev

symfony shortCodes bundle

From Dev

Lexik Filter-: Argument 1 passed to Symfony\Component\Form\FormRenderer::searchAndRenderBlock()

From Dev

Symfony 2 generate:bundle - with or without namespace /Bundle/

From Dev

Symfony3 HWIOauth Bundle can't use/find Google Login-Check route

From Dev

symfony3 & SonataAdmin & Formatter Bundle - Error when using formatter options "target_field" do not exist

From Dev

Image Upload Issue with Symfony3, Doctrine 2 and Sonata Admin Bundle

From Dev

symfony 3.1 Check if a bundle is installed

From Dev

Symfony 2 - Generating a Bundle (Windows)

Related Related

  1. 1

    Symfony 3: How to create a private bundle

  2. 2

    Unable to install bundle for Symfony 3 using Composer

  3. 3

    Sonata User Bundle + Symfony 3.x

  4. 4

    API Post to Sonata Media Bundle Symfony 3

  5. 5

    How to auto generate a bundle in Symfony3?

  6. 6

    Symfony 3 - Sonata Aplication Media Bundle error

  7. 7

    Unable to configure Symfony (3rd party) bundle

  8. 8

    Symfony 3 + FOS REST Bundle: Normalize values before validation

  9. 9

    Symfony3 - MISD Phone Number Bundle format

  10. 10

    What is wrong with my bundle extension class ( symfony 3 )?

  11. 11

    Symfony 3 - Ckeditor bundle : Unrecognized options "template, template_parameters"

  12. 12

    Extract the current namespace, bundle, controller and action name symfony3

  13. 13

    Symfony 3 overwrite FOS UserTemplate - but put the Views in my Bundle

  14. 14

    Symfony call a bundle in an other bundle

  15. 15

    Symfony Add Bundle

  16. 16

    Symfony solr bundle 2.8 +

  17. 17

    sonata admin bundle symfony

  18. 18

    New symfony bundle, when

  19. 19

    Symfony Add Bundle

  20. 20

    Reusing Entities on symfony bundle

  21. 21

    Symfony solr bundle 2.8 +

  22. 22

    symfony shortCodes bundle

  23. 23

    Lexik Filter-: Argument 1 passed to Symfony\Component\Form\FormRenderer::searchAndRenderBlock()

  24. 24

    Symfony 2 generate:bundle - with or without namespace /Bundle/

  25. 25

    Symfony3 HWIOauth Bundle can't use/find Google Login-Check route

  26. 26

    symfony3 & SonataAdmin & Formatter Bundle - Error when using formatter options "target_field" do not exist

  27. 27

    Image Upload Issue with Symfony3, Doctrine 2 and Sonata Admin Bundle

  28. 28

    symfony 3.1 Check if a bundle is installed

  29. 29

    Symfony 2 - Generating a Bundle (Windows)

HotTag

Archive