php - iOS - Sending authentication to FOSUserBundle Database not working but cURL works -


i have table managed fosuserbundle users in in symfony2 application. able access routes protected firewall curl without problems. let's have route /api/something protected , wanted access curl, used:

   curl -v -u paul  http://example/web/app_dev.php/api/something/  

the above works no problem. however, app, returned 401: not authenticatedd when use following snippet below. converted base 64 since afnetworking says has in format. missing??

    nsdata *pass = [@"somestring" datausingencoding:nsutf8stringencoding];     nsstring *base64pass = [pass base64encodedstringwithoptions:0];     nsdata *user = [@"anotherstring" datausingencoding:nsutf8stringencoding];     nsstring *base64user = [user1 base64encodedstringwithoptions:0];      [self registerhttpoperationclass:[afjsonrequestoperation class]];     [self setdefaultheader:@"accept" value:@"application/json"];     [self setauthorizationheaderwithusername:base64user password:base64pass]; 

here http header returned , afnetworking not setting headers. how can accomplish task?

{ status code: 401, headers {     allow = "get, post";     "cache-control" = "no-cache";     connection = "keep-alive";     "content-type" = "application/json";     date = "fri, 31 jan 2014 14:25:48 gmt";     "keep-alive" = "timeout=5, max=100";     server = "apache/2.2.22 (ubuntu)";     "transfer-encoding" = identity;     "x-debug-token" = c562ea;     "x-powered-by" = "php/5.3.10-1ubuntu3.9"; }  

i don't know how you'll set on code. here catch. since have empty password, make base64 of paul: way(remember colon).

base_64 = base64 of "paul:" 

then set http header.

authorization: basic base_64 

of course remove 1 requesting authorization through headers.

[self setauthorizationheaderwithusername:base64user password:base64pass]; 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -