Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7601637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:12:48+00:00 2026-05-30T23:12:48+00:00

A desktop application interacts with my website running on symfony2 and requires response in

  • 0

A desktop application interacts with my website running on symfony2 and requires response in json, beginning with login success/failure. Using http_basic and providers if the login is correct everything works fine, but Im not able to send the json response.
And if the login is incorrect it re-prompts the username and password dialog. How can I stop at the first failure attempt and send the json response

{
'message':'invalid password/username'
}

security.yml

 app:
            pattern:   ^/app.*
            logout: true 
            security: true
            http_basic:             
              provider: webservice  
providers:
        fos_userbundle:
            id: fos_user.user_manager

        webservice:
            id: my_provider

config.yml

my_provider:      
        parent: doctrine.odm.mongodb.security.user.provider
        arguments: [ Se\PPBundle\Document\User, username]

tl;dr
I want to respond with json on login.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:12:49+00:00Added an answer on May 30, 2026 at 11:12 pm

    From the looks of it you are using the FOS User bundle to handle your authentication. If this is the case you will need to overload the FOS Security controller login action. Change the logic in there to send a difference response on fail instead of just rendering the view with the errors. You will also need to customize the routing for the login. Something to the effect of:

    _login:
        pattern: /login
        defaults: {_controller: "FOSUserBundle:Security:login", _format:json}
    

    Note the _format:json this will return your responses as “application/json” you will still need to json_encode the return

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a desktop client application developed in Swing. This application interacts with backend
My desktop application serializes objects using XmlSerializer . I was suggested to leverage DataContractSerializer
I am developing desktop application using vb.net and vs2008. I have a DropDownList that
I have to develop a desktop application using Java. I've some experience with Java
We've developed a desktop application using .NetFX3.5 which has some winforms and two WPF
In a Java Swing desktop application running on Linux (e.g., Ubuntu), how can the
I am developing a desktop application using swingx, spring and using ant to build
For desktop application that is. This is just a general question that maybe only
I have a .Net desktop application with a TreeView as one of the UI
In a desktop application needing some serious re-factoring, I have several chunks of code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.