commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
a0a843
|
17 |
|
H |
18 |
#import <Foundation/Foundation.h> |
|
19 |
|
|
20 |
NS_ASSUME_NONNULL_BEGIN |
|
21 |
|
655e66
|
22 |
FOUNDATION_EXTERN NSString *const TWTROAuthEchoRequestURLStringKey; |
H |
23 |
FOUNDATION_EXTERN NSString *const TWTROAuthEchoAuthorizationHeaderKey; |
a0a843
|
24 |
|
H |
25 |
@protocol TWTRCoreOAuthSigning <NSObject> |
|
26 |
|
|
27 |
/** |
|
28 |
* @name OAuth Echo |
|
29 |
*/ |
|
30 |
|
|
31 |
/** |
|
32 |
* OAuth Echo is a means to securely delegate OAuth authorization to a third party while interacting with an API. |
|
33 |
* For example, you may wish to verify a user's credentials from your app's server (the third party) rather than your app. |
|
34 |
* This method provides you with the OAuth signature to add to the third party's request to `URLString`, as well as the formed |
|
35 |
* URL with the query string to send that request to. |
|
36 |
* This is equivalent to calling `-URLRequestWithMethod:URL:parameters:error:` and getting the URL and the `Authorization` HTTP header out of the request. |
|
37 |
* |
|
38 |
* @param method Request method, GET, POST, PUT, DELETE, etc. |
|
39 |
* @param URLString The full URL of the Twitter endpoint you plan to send a request to. E.g. https://api.twitter.com/1.1/account/verify_credentials.json |
|
40 |
* @param parameters Request parameters. |
|
41 |
* @param error Error in the `TWTRErrorDomain` domain. The code will be `TWTRErrorCodeInvalidURL` if the `URLString`'s host is not api.twitter.com |
|
42 |
* |
|
43 |
* @return `nil` if there's an error or a missing required parameter, or a dictionary with the fully formed request URL under `TWTROAuthEchoRequestURLStringKey` (`NSString`), and the `Authorization` header in `TWTROAuthEchoAuthorizationHeaderKey` (`NSString`), to be used to sign the request. |
|
44 |
* |
|
45 |
* @see More information about OAuth Echo: https://dev.twitter.com/oauth/echo |
|
46 |
*/ |
|
47 |
- (NSDictionary *)OAuthEchoHeadersForRequestMethod:(NSString *)method URLString:(NSString *)URLString parameters:(nullable NSDictionary *)parameters error:(NSError **)error; |
|
48 |
|
|
49 |
/** |
|
50 |
* This method provides you with the OAuth signature, as well as the formed URL with the query string, to send a request to `verify_credentials`. |
|
51 |
* |
|
52 |
* @return A dictionary with the fully formed Request URL under `TWTROAuthEchoRequestURLStringKey` (`NSString`), and the `Authorization` header in `TWTROAuthEchoAuthorizationHeaderKey` (`NSString`), to be used to sign the request. |
|
53 |
* |
|
54 |
* @see More information about OAuth Echo: https://dev.twitter.com/oauth/echo |
|
55 |
* @see More information about Verify Credentials: https://dev.twitter.com/rest/reference/get/account/verify_credentials |
|
56 |
*/ |
|
57 |
- (NSDictionary *)OAuthEchoHeadersToVerifyCredentials; |
|
58 |
|
|
59 |
@end |
|
60 |
|
|
61 |
NS_ASSUME_NONNULL_END |