Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FBSDKAccessToken.h « Headers « FBSDKCoreKit.framework « Statistics « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab9f9b97bf02027c5d2b3e2e01eb8b21011e9326 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>

#import <FBSDKCoreKit/FBSDKCopying.h>
#import <FBSDKCoreKit/FBSDKGraphRequestConnection.h>
#import <FBSDKCoreKit/FBSDKMacros.h>

/*!
 @abstract Notification indicating that the `currentAccessToken` has changed.
 @discussion the userInfo dictionary of the notification will contain keys
 `FBSDKAccessTokenChangeOldKey` and
 `FBSDKAccessTokenChangeNewKey`.
 */
FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification;

/*!
 @abstract A key in the notification's userInfo that will be set
  if and only if the user ID changed between the old and new tokens.
 @discussion Token refreshes can occur automatically with the SDK
  which do not change the user. If you're only interested in user
  changes (such as logging out), you should check for the existence
  of this key. The value is a NSNumber with a boolValue.

  On a fresh start of the app where the SDK reads in the cached value
  of an access token, this key will also exist since the access token
  is moving from a null state (no user) to a non-null state (user).
 */
FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeUserID;

/*
 @abstract key in notification's userInfo object for getting the old token.
 @discussion If there was no old token, the key will not be present.
 */
FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeOldKey;

/*
 @abstract key in notification's userInfo object for getting the new token.
 @discussion If there is no new token, the key will not be present.
 */
FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeNewKey;


/*!
 @class FBSDKAccessToken
 @abstract Represents an immutable access token for using Facebook services.
 */
@interface FBSDKAccessToken : NSObject<FBSDKCopying, NSSecureCoding>

/*!
 @abstract Returns the app ID.
 */
@property (readonly, copy, nonatomic) NSString *appID;

/*!
 @abstract Returns the known declined permissions.
 */
@property (readonly, copy, nonatomic) NSSet *declinedPermissions;

/*!
 @abstract Returns the expiration date.
 */
@property (readonly, copy, nonatomic) NSDate *expirationDate;

/*!
 @abstract Returns the known granted permissions.
 */
@property (readonly, copy, nonatomic) NSSet *permissions;

/*!
 @abstract Returns the date the token was last refreshed.
*/
@property (readonly, copy, nonatomic) NSDate *refreshDate;

/*!
 @abstract Returns the opaque token string.
 */
@property (readonly, copy, nonatomic) NSString *tokenString;

/*!
 @abstract Returns the user ID.
 */
@property (readonly, copy, nonatomic) NSString *userID;

/*!
 @abstract Initializes a new instance.
 @param tokenString the opaque token string.
 @param permissions the granted permissions. Note this is converted to NSSet and is only
 an NSArray for the convenience of literal syntax.
 @param declinedPermissions the declined permissions. Note this is converted to NSSet and is only
 an NSArray for the convenience of literal syntax.
 @param appID the app ID.
 @param userID the user ID.
 @param expirationDate the optional expiration date (defaults to distantFuture).
 @param refreshDate the optional date the token was last refreshed (defaults to today).
 @discussion This initializer should only be used for advanced apps that
 manage tokens explicitly. Typical login flows only need to use `FBSDKLoginManager`
 along with `+currentAccessToken`.
 */
- (instancetype)initWithTokenString:(NSString *)tokenString
                        permissions:(NSArray *)permissions
                declinedPermissions:(NSArray *)declinedPermissions
                              appID:(NSString *)appID
                             userID:(NSString *)userID
                     expirationDate:(NSDate *)expirationDate
                        refreshDate:(NSDate *)refreshDate
NS_DESIGNATED_INITIALIZER;

/*!
 @abstract Convenience getter to determine if a permission has been granted
 @param permission  The permission to check.
 */
- (BOOL)hasGranted:(NSString *)permission;

/*!
 @abstract Compares the receiver to another FBSDKAccessToken
 @param token The other token
 @return YES if the receiver's values are equal to the other token's values; otherwise NO
 */
- (BOOL)isEqualToAccessToken:(FBSDKAccessToken *)token;

/*!
 @abstract Returns the "global" access token that represents the currently logged in user.
 @discussion The `currentAccessToken` is a convenient representation of the token of the
 current user and is used by other SDK components (like `FBSDKLoginManager`).
 */
+ (FBSDKAccessToken *)currentAccessToken;

/*!
 @abstract Sets the "global" access token that represents the currently logged in user.
 @param token The access token to set.
 @discussion This will broadcast a notification and save the token to the app keychain.
 */
+ (void)setCurrentAccessToken:(FBSDKAccessToken *)token;

/*!
 @abstract Refresh the current access token's permission state and extend the token's expiration date,
  if possible.
 @param completionHandler an optional callback handler that can surface any errors related to permission refreshing.
 @discussion On a successful refresh, the currentAccessToken will be updated so you typically only need to
  observe the `FBSDKAccessTokenDidChangeNotification` notification.

 If a token is already expired, it cannot be refreshed.
 */
+ (void)refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler;

@end