Reputation: 5321
I am currently trying to implement authorization with AFNetworking. I tried to put the access_token inside the HTTP-Authorizationheader. But what arrives at the server is like :
Token token = "\fdasfjhalsfh4546"
It should be just the token-value inside the Header. My Code looks like this :
- (void)setAuthTokenHeader {
CredentialStore *store = [[CredentialStore alloc] init];
[self setAuthorizationHeaderWithToken:[store authToken]];
}
[store authToken]
just returns the authtoken itself, so I don't understand why the HTTP-Field-Content looks like this?
Upvotes: 3
Views: 2193
Reputation: 5321
The Problem is way easier then i thought. It seems that Afnetworking appends the token by default to that string :
- (void)setAuthorizationHeaderWithToken:(NSString *)token {
[self setDefaultHeader:@"Authorization" value:[NSString stringWithFormat:@"Token token=\"%@\"", token]];
}
Upvotes: 4