Created
February 19, 2012 23:35
-
-
Save jverkoey/1866500 to your computer and use it in GitHub Desktop.
Nimbus OAuth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef enum { | |
NIOpenAuthenticationStateFetchingToken, | |
NIOpenAuthenticationStateAuthorized, | |
} NIOpenAuthenticationState; | |
// Step 1: Create an auth object that will capture the token. | |
self.auth = [[[NISoundCloudOpenAuthenticator alloc] | |
initWithClientIdentifier:@"xxxxxx" | |
clientSecret:@"xxxxxx"] autorelease]; | |
// Step 2: Perform the authentication. | |
[self.auth authenticateWithStateHandler: | |
^(NIOpenAuthenticator* auth, NIOpenAuthenticationState state, NSError* error) { | |
NSLog(@"State: %d", state); | |
if (NIOpenAuthenticationStateAuthorized == state) { | |
// auth.oauthToken is now valid | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment