UPPlatform Class Reference
| Inherits from | NSObject |
| Declared in | UPPlatform.h UPPlatform.m |
Overview
The base platform object, which manages the current session, authentication, and HTTP requests.
Tasks
-
currentSessionproperty -
redirectURIproperty -
enableNetworkLoggingproperty -
+ sharedPlatform -
+ basePlatformURL -
+ currentPlatformVersion -
– validateSessionWithCompletion: -
– refreshAccessTokenWithClientID:clientSecret:completion: -
– startSessionWithClientID:clientSecret:webView:completion: -
– startSessionWithClientID:clientSecret:webView:authScope:completion: -
– startSessionWithClientID:clientSecret:completion: -
– startSessionWithClientID:clientSecret:authScope:completion: -
– startSessionWithClientID:clientSecret:authScope:redirectURI:completion: -
– endCurrentSession -
– sendRequest:completion:
Properties
currentSession
The current session, if active. Will be nil if the user has not authenticated.
@property (nonatomic, readonly) UPSession *currentSessionDiscussion
The current session, if active. Will be nil if the user has not authenticated.
Declared In
UPPlatform.henableNetworkLogging
Flag to enable extra network logging. Setting this to YES will log all HTTP requests and responses sent via UPPlatform.
@property (nonatomic, assign) BOOL enableNetworkLoggingDiscussion
Flag to enable extra network logging. Setting this to YES will log all HTTP requests and responses sent via UPPlatform.
Declared In
UPPlatform.hClass Methods
basePlatformURL
The base URL for the platform.
+ (NSString *)basePlatformURLDiscussion
The base URL for the platform.
Declared In
UPPlatform.hInstance Methods
endCurrentSession
Ends the current session, clearing the session and access token.
- (void)endCurrentSessionDiscussion
Ends the current session, clearing the session and access token.
Declared In
UPPlatform.hrefreshAccessTokenWithClientID:clientSecret:completion:
Refreshes the current access token.
- (void)refreshAccessTokenWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret completion:(UPPlatformSessionCompletion)completionDiscussion
Refreshes the current access token.
Declared In
UPPlatform.hsendRequest:completion:
Sends an HTTP request, setting appropriate authentication headers based on the current session.
- (void)sendRequest:(UPURLRequest *)request completion:(UPPlatformRequestCompletion)completionParameters
- request
The request to send.
- completion
The request completion block after receiving a response or error.
Discussion
Sends an HTTP request, setting appropriate authentication headers based on the current session.
Declared In
UPPlatform.hstartSessionWithClientID:clientSecret:authScope:completion:
Starts a user’s session.
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope completion:(UPPlatformSessionCompletion)completionParameters
- clientID
The client ID provided during application signup.
- clientSecret
The client secret provided during application signup.
- authScope
Options to request specific auth scopes during authentication. Defaults to UPPlatformAuthScopeBasicRead.
- completion
The session completion block.
Discussion
Starts a user’s session.
This will present a UIWebView to perform the OAuth authentication flow, taking care of getting the access token for HTTP requests.
Declared In
UPPlatform.hstartSessionWithClientID:clientSecret:authScope:redirectURI:completion:
Starts a user’s session.
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI completion:(UPPlatformSessionCompletion)completionParameters
- clientID
The client ID provided during application signup.
- clientSecret
The client secret provided during application signup.
- authScope
Options to request specific auth scopes during authentication. Defaults to UPPlatformAuthScopeBasicRead.
- redirectURI
An alternate redirect URI used during authentication. This is not common.
- completion
The session completion block.
Discussion
Starts a user’s session.
This will present a UIWebView to perform the OAuth authentication flow, taking care of getting the access token for HTTP requests.
Declared In
UPPlatform.hstartSessionWithClientID:clientSecret:completion:
Starts a user’s session.
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret completion:(UPPlatformSessionCompletion)completionParameters
- clientID
The client ID provided during application signup.
- clientSecret
The client secret provided during application signup.
- completion
The session completion block.
Discussion
Starts a user’s session.
This will present a UIWebView to perform the OAuth authentication flow, taking care of getting the access token for HTTP requests.
Declared In
UPPlatform.hstartSessionWithClientID:clientSecret:webView:authScope:completion:
Starts a user’s session.
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret webView:(WebView *)webView authScope:(UPPlatformAuthScope)authScope completion:(UPPlatformSessionCompletion)completionParameters
- clientID
The client ID provided during application signup.
- clientSecret
The client secret provided during application signup.
- webView
An existing WebView to perform authentication. Will create a new window with a single WebView if nil.
- authScope
Options to request specific auth scopes during authentication. Defaults to UPPlatformAuthScopeBasicRead.
- completion
The session completion block.
Discussion
Starts a user’s session.
This will present a WebView to perform the OAuth authentication flow, taking care of getting access token for HTTP requests. An existing WebView can be provided, or one will be created in a new window if nil is provided.
Declared In
UPPlatform.hstartSessionWithClientID:clientSecret:webView:completion:
Starts a user’s session.
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret webView:(WebView *)webView completion:(UPPlatformSessionCompletion)completionParameters
- clientID
The client ID provided during application signup.
- clientSecret
The client secret provided during application signup.
- webView
An existing WebView to perform authentication. Will create a new window with a single WebView if nil.
- completion
The session completion block.
Discussion
Starts a user’s session.
This will present a WebView to perform the OAuth authentication flow, taking care of getting access token for HTTP requests. An existing WebView can be provided, or one will be created in a new window if nil is provided.
Declared In
UPPlatform.hvalidateSessionWithCompletion:
Validates the current session.
- (void)validateSessionWithCompletion:(UPPlatformSessionCompletion)completionParameters
- completion
The session completion block. If the session object passed to the completion block is not nil, the session is valid and API requests can be made.
Discussion
Validates the current session.
This method is useful in order to prevent any API requests from unexpectedly returning a 401 Unauthorized response when the user’s access token is not valid.
Declared In
UPPlatform.h