Skip to content

Instantly share code, notes, and snippets.

@jverkoey
Created February 19, 2012 23:35
Show Gist options
  • Save jverkoey/1866500 to your computer and use it in GitHub Desktop.
Save jverkoey/1866500 to your computer and use it in GitHub Desktop.
Nimbus OAuth
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