Skip to content

Instantly share code, notes, and snippets.

@brspurri
Forked from jverkoey/gist:1866500
Created February 21, 2012 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brspurri/1878297 to your computer and use it in GitHub Desktop.
Save brspurri/1878297 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