I am trying to authenticate a user on my symfony2 server. Authentication works with curl in cli:
curl "http://localhost:8080/app_dev.php/app/user/profile.json?id=4" -u foo:bar --basic
But with Android, I always get error 401 with this error:
A Token was not found in the SecurityContext.
What can I do to fix this?
Here is my security.yml:
security: providers: fos_userbundle: id: fos_user.user_manager encoders: BumpMe\UserBundle\Entity\User: sha512 firewalls: app: pattern: ^/app/.* stateless: true security: true http_basic: realm: "API" main: pattern: ^/ form_login: provider: fos_userbundle logout: true anonymous: true access_control: - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin/, role: ROLE_ADMIN } - { path: ^/app/, role: ROLE_USER } role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: ROLE_ADMIN
Also, how can I send username and password in base64? Since currently on Android, he doesn't want base64 and curl to send it to base64 ...
I do not understand this error ...
source share