dev:app_authentication_example
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:app_authentication_example [2016/04/21 17:04] – su | dev:app_authentication_example [2017/11/21 16:46] (current) – su | ||
---|---|---|---|
Line 5: | Line 5: | ||
[https:// | [https:// | ||
- | OAuth is used extensively on the web already: if you have ever logged into a 3rd party web site using your Facebook, Google, or LinkedIn account, you have already used OAuth. | + | OAuth is used extensively on the web already: if you have ever logged into a 3rd party web site using your Facebook, Google, or LinkedIn account, you have already used OAuth. |
- | In addition to using LinkedIn' | + | The App Store also has its own OAuth service, to allow applications such as the Valve Signature Tool to log users in via the App Store, and to allow those applications to charge users for application usage. |
Below is a simple example illustrating the [[https:// | Below is a simple example illustrating the [[https:// | ||
Line 99: | Line 99: | ||
==== 3. Authenticated Requests ==== | ==== 3. Authenticated Requests ==== | ||
- | Now that you have an access token, you can make requests to the App Store API. You can make an API request using cURL as follows: | + | Now that you have an access token, you can make requests to the App Store API. |
+ | |||
+ | === 3.1 Access Tokens === | ||
+ | |||
+ | When an application logs a user in via an OAuth service, they receive an access token for the user, also known as a bearer token, as well as information about when the access token expires, and (possibly) a refresh token that can be used to retrieve a new access token when the old one expires, instead of requiring the user to explicitly log into the application again. | ||
+ | |||
+ | The token contains embedded information about the user, and is signed and encrypted by the OAuth service so that only the machine that issued the token can authenticate requests made using the token. | ||
+ | |||
+ | To authenticate requests made to the App Store API, the calling application must include a valid access token in the HTTP headers of the request. The token is specified | ||
< | < | ||
- | curl -H "Authorization: | + | var request = new HttpRequestMessage(HttpMethod.Get, |
- | https:// | + | request.Authorization = new AuthenticationHeaderValue(" |
+ | |||
+ | var response = await httpClient.SendAsync(request, | ||
+ | ... | ||
</ | </ | ||
dev/app_authentication_example.1461258260.txt.gz · Last modified: 2016/04/21 17:04 by su