- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
of this account. in Java
of this account. Printing QR Code 2d Barcode In Java Using Barcode creation for Android Control to generate, create QR-Code image in Android applications. www.OnBarcode.comMake Barcode In Java Using Barcode creator for Android Control to generate, create Barcode image in Android applications. www.OnBarcode.com Authentication token A transient string, known to the account but generally not
ANSI/AIM Code 39 Drawer In Java Using Barcode encoder for Android Control to generate, create Code 39 Extended image in Android applications. www.OnBarcode.comMake Code 128 Code Set C In Java Using Barcode drawer for Android Control to generate, create Code-128 image in Android applications. www.OnBarcode.comto the user, which demonstrates that the user has successfully logged in to the account. Often referred to as an auth token, this string frees the user from the need to manually type the password every time she wishes to connect with the account, and saves the server from performing additional, time-consuming authentications. An auth token is usually valid for a limited amount of time, and must occasionally be refreshed by performing a full login. All of this data is stored and managed by AccountManager, as shown in figure 15.11. In this example, the user already has two active accounts on his device, which are currently authenticated. A third account can be added by providing the relevant account details, in this case a name and password. Once verified by AccountManager, this account will be accessible like the others. Generate Denso QR Bar Code In Java Using Barcode creation for Android Control to generate, create Denso QR Bar Code image in Android applications. www.OnBarcode.comCreating Barcode In Java Using Barcode creation for Android Control to generate, create Barcode image in Android applications. www.OnBarcode.comIntegration
Barcode Generator In Java Using Barcode creation for Android Control to generate, create Barcode image in Android applications. www.OnBarcode.comInternational Standard Book Number Maker In Java Using Barcode printer for Android Control to generate, create Bookland EAN image in Android applications. www.OnBarcode.comAccount Manager
Encode QR-Code In Java Using Barcode generator for Java Control to generate, create Denso QR Bar Code image in Java applications. www.OnBarcode.comMake QR Code JIS X 0510 In VB.NET Using Barcode creation for .NET framework Control to generate, create QR Code ISO/IEC18004 image in .NET applications. www.OnBarcode.comGoogle
Scan PDF417 In Java Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comScanning Code 3/9 In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comExchange
USS Code 128 Reader In Java Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comGenerating QR-Code In None Using Barcode printer for Font Control to generate, create QR Code JIS X 0510 image in Font applications. www.OnBarcode.comFacebook
GS1 - 12 Generator In None Using Barcode maker for Office Word Control to generate, create GTIN - 12 image in Microsoft Word applications. www.OnBarcode.comGenerating Code 3/9 In C#.NET Using Barcode creator for Visual Studio .NET Control to generate, create Code 39 image in .NET framework applications. www.OnBarcode.comName
UPC - 13 Encoder In Java Using Barcode creation for Eclipse BIRT Control to generate, create GS1 - 13 image in BIRT applications. www.OnBarcode.comPaint Data Matrix 2d Barcode In None Using Barcode printer for Microsoft Excel Control to generate, create Data Matrix 2d barcode image in Excel applications. www.OnBarcode.comPassword
UPC A Printer In None Using Barcode drawer for Online Control to generate, create UPCA image in Online applications. www.OnBarcode.comDraw UPCA In None Using Barcode generation for Font Control to generate, create UPC-A image in Font applications. www.OnBarcode.comAuth Token
Name
Password
Name
Password
Auth Token
Figure 15.11 Managing multiple accounts
Many permissions are required for implementing accounts. Be sure to claim the MANAGE_ACCOUNTS permission if your app will be creating or modifying accounts, and the AUTHENTICATE_ACCOUNTS permission for managing passwords and auth tokens. Many other permissions may be required as well, including GET_ACCOUNTS, USE_CREDENTIALS, and WRITE_SETTINGS. Most applications that provide new accounts will eventually require all of these and more. See a complete list in the sample manifest near the end of this chapter. CAUTION
15.5 Creating a LinkedIn account
From a user s perspective, connecting to LinkedIn looks simple. You just type in your email address and password, and you get access. Behind the scenes, though, a lot more is going on, particularly when connecting from a third-party application. No fewer than seven tokens are involved as part of the authentication process, and all must be handled correctly before you can start requesting data. This isn t unique to LinkedIn, and learning how to navigate the LinkedIn authentication process will equip you well for handling almost any authentication scheme. 15.5.1 Not friendly to mobile
To protect against people viewing others private information, LinkedIn requires each user of a third-party app to sign in to their account through the LinkedIn portal. Once they do, LinkedIn returns two authentication tokens that ll be included in all future requests. LinkedIn wrote its API assuming that developers would write web applications. The web app will redirect the user to the official LinkedIn login page, and LinkedIn will return the user to a URL specified by the developer once the login is complete. But this system doesn t work well for other platforms such as desktop and mobile applications. LinkedIn has no way of passing the authentication token directly to your app, so you must jump through extra hoops to obtain this necessary information. Creating a LinkedIn account
15.5.2 Authenticating to LinkedIn
Fortunately, Android s AccountManager system provides a perfect solution to circumvent this problem. You can use the custom login Activity to guide the user through the process of authenticating with LinkedIn, and then securely store the tokens for all future requests. LinkedIn is unusual in that it actually returns two auth tokens, both a public one and a secret version. Android s AccountManager is robust and extensible enough to accept arbitrary data beyond the traditional username/password/authtoken combo, and so the complexity of authenticating with LinkedIn can be hidden. The UI will contain a few important sections. An email address will uniquely identify the account. The activity will contain a link to the LinkedIn login page where the user can remotely authenticate. After she gets Figure 15.12 Login screen for her secure token, it can be entered back into the login LinkedIn account page to finish the authentication process. You start by defining the UI, which will look like figure 15.12. The layout XML for this listing is available online on the website for this book. Next, you write the main Activity for our application, shown in the following listing. In addition to configuring the UI, it manages the two-stage process of authenticating against LinkedIn. This activity is responsible for many details; only the most important are printed here, but you can view the entire class in the download from this book s website.
|
|