/
ANAuthenticator.h
42 lines (29 loc) · 1.39 KB
/
ANAuthenticator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// ADAppNetAuthenticator.h
// AppNetKit
//
// Created by Brent Royal-Gordon on 8/17/12.
// Copyright (c) 2012 Architechies. See README.md for licensing information.
//
#import <Foundation/Foundation.h>
#import "AppNetKit.h"
extern NSString * const ANScopeStream;
extern NSString * const ANScopeEmail;
extern NSString * const ANScopeWritePost;
extern NSString * const ANScopeFollow;
extern NSString * const ANScopeMessages;
extern NSString * const ANScopeExport;
@interface ANAuthenticator : NSObject
+ (ANAuthenticator*)sharedAuthenticator;
@property (strong,nonatomic) NSString * clientID;
#pragma mark OAuth authentication flow
@property (strong,nonatomic) NSURL * redirectURL;
@property (assign,nonatomic) BOOL omitsPaymentOptions;
- (NSURL*)URLToAuthenticateForScopes:(NSArray*)scopes; // Briefly shows a blank screen if the user has already logged in
- (NSURL*)URLToAuthorizeForScopes:(NSArray *)scopes; // Always shows a permission screen, even if the user has already logged in
- (BOOL)isRedirectURL:(NSURL*)url;
- (NSString*)accessTokenFromRedirectURL:(NSURL*)redirectURL error:(NSError**)error;
#pragma mark Password authentication flow
@property (strong,nonatomic) NSString * passwordGrantSecret;
- (void)accessTokenForScopes:(NSArray *)scopes withUsername:(NSString *)username password:(NSString *)password completion:(void (^)(NSString *accessToken, id rep, NSError * error))completion;
@end