Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Basic Authorisation with back slash \ in username using Objective C

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 325
    Answer it

    I have to use basic authorisation in my https request. I am using the following code :

    NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"p5\test", @"password"];
    NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
    NSString *base64String = [authData base64EncodedStringWithOptions:0];
    NSString *authValue = [NSString stringWithFormat:@"Basic %@", base64String];
    NSDictionary *data=@{@"Authorization":authValue};
    

    But it always giving unauthorized 401 error. I have doubt might be username with backslash creating problem.

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: