NSURLCredential is an immutable object representing an authentication credential consisting of authentication information specific to the type of credential and the type of persistent storage to use, if any.
Questions tagged [nsurlcredential]
67 questions
3
votes
1 answer
URLSession Credentials Caching Allowing Authentication with Incorrect Credentials
I am trying to communicate with my company's API in my iOS app. I am using the standard URLSession.
The API will load balance and redirect to a different server automatically, so I've implemented the URLSessionDelegate and URLSessionTaskDelegate…

adamacdo
- 426
- 1
- 6
- 14
3
votes
1 answer
NSURLCredential and NSURLConnection
I have been trying to search for a way to unset the credentials once you set a NSURLCredential with a NSURLConnection that is using NSURLCredentialPersistenceForSession, but I couldn't find a working solution. Removing the NSURLCredential from the…

GRMrGecko
- 321
- 4
- 9
3
votes
1 answer
How to change credentials for NSURLSession
I have the following problem: I am making requests to a server, which uses HTTP basic auth and gives me
a 401 if I do not send authentication
a 401 if I send invalid authentication
a 403 if I send valid authentication but the resource is forbidden…

Thorsten Karrer
- 1,345
- 9
- 19
3
votes
0 answers
iOS how to properly retrieve a credential from NSURLCredentialStorage?
I'm running into an issue where I can't retrieve a credential from NSURLCredentialStorage, even if I try this immediately after saving.
The credential is properly formatted and is accepted by the server, it is set to be permanent. I have debug code…

Alex Stone
- 46,408
- 55
- 231
- 407
3
votes
0 answers
Watch OS : NSUrlSession Credential caching
I want to implement "logout and new login" feature from iPhone and Apple Watch.
I am able to clear the credentials from iPhone (Using NSURLConnection because its old code) after logout, but not able to from apple watch (Using NSURLSession).
I am…

Rajeev
- 31
- 2
3
votes
1 answer
NSURLCredential Authentication with only one key
I have an iOS app which logs-in a user and then authenticates that user with an appKey. The didReceiveAuthenticationChallenge delegate method on NSURLConnection is sufficient for providing a username / password with an NSURLCredential. However, I'm…

Sam Spencer
- 8,492
- 12
- 76
- 133
3
votes
1 answer
NSURLCredential password occasionally returns no password
The Apple documentation for NSURLCredential says that it may not always return a password. But other than the obvious reason that no password was stored with credential, is there any reason that a default credential permanently stored in…

len.kawell
- 31
- 1
2
votes
1 answer
How to authenticate using sendSynchronous request in NSURLConnection
Can any one tell me how to send a authentication request using the NSURLConnection.I tried out the following code snippet by following the link stackoverflow question but still its not working.
I want to authenticate using synchronous request and…

prajul
- 1,216
- 2
- 15
- 27
2
votes
0 answers
Is there support for resumed TLS connections with NSUrlCredential/NSUrlConnection
TLS handshaking on every micro request is not a good idea. I read about resumed TLS sessions that have less overhead. I'm not clear if this is supported in NSUrlConnection when used with NSUrlCredential/NSUrlCredentialStorage.
Has anyone had some…

kasuku
- 371
- 3
- 13
2
votes
0 answers
Can't remove NSURLCredentials from storage
I'm trying to remove credentials from storage when an account is deleted from my app. Here's the code I'm using:
NSDictionary *dict = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials];
NSDictionary *dictCopy = [dict…

JPC
- 8,096
- 22
- 77
- 110
2
votes
0 answers
NSURLCredentialPersistencePermanent doesn't seem permanent?
I've been trying to solve this for some time now, but without success. Questions such as this one here or tuts on using authentication by apple and other blogs shed some light but not all.
My basic problem I'd like to solve is the following:
I'm…

Mike F
- 1,224
- 4
- 26
- 44
2
votes
2 answers
NSURLCredential is permanent?
We have a problem with our iPhone-simulator that was caused by using this line:
Foo = [NSURLCredential CredentialWithUser:foo
password:bar persistance:NSURLCredentialPersistencePermanent];
The problem was created when the credential was…

Jens Bergvall
- 1,617
- 2
- 24
- 54
2
votes
1 answer
App freezes when didReceiveChallenge method called
I am attempting to connect to an API using a self-signed certificate for testing.
-(NSData*)getDataFromPostRequestWithHeaders:(NSDictionary*)headers withPostData:(NSData*)postData fromURL:(NSString*)urlString
{
__block NSData*…

Michael Nares
- 401
- 4
- 19
2
votes
1 answer
Authentication challenge with NSURLSession: NSURLCredentialStorage vs Keychain
I'm trying to learn how to deal with an authentication challenge using NSURLSession. I've never previously done anything related to secure networking. I've been reading the Authentication Challenges and TLS Chain Validation section in Apple's…

AppsDev
- 12,319
- 23
- 93
- 186
2
votes
1 answer
NSURLSession with backgroundSessionConfiguration can not work with user certificate
I found a wired thing about NSURLSession when using background session configuration.
We use a self asigned certificate when contact with server, an implement:
- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask…

user3897968
- 41
- 2