Android Authentication - Add new account supporting OAuth2
I was involved in an on-going Android App development these days. The task for me is to make a new account type on the Android OS for the App. The account is supposed to comply with the specifications of OAuth2. The user could add a new account on his/her Android device, and in this process, the user will be prompted to supply his/her credentials on a web page which is opened by the Android App. After the user is logged in on the web page another web page turns up to ask the user to give authorization to the App to get access to the user’s private data from the web server. An access-token will be issued by the web server to the App if the user granted the App by choosing “OK” button on the authorization web page. Once been authorized, there will be a new account registered on the Android device. The App could access the protected data on the web server later with the obtained access-token without any further permission from the user.
I develop the Activities for the App to perform the whole authentication process. Here I just put some diagrams to be referred to by my technical blog written in Chinese. These diagrams are all high-resolution images that are not fully displayed in a web browser with a normal computer screen.
- Class diagram ↓. Click here to view it in full size. This diagram is generated by draw.io by the way.
- Flowchart ↓. Click here to view it in full size. Also generated by draw.io by the way. This flowchart is for the AsyncTask that retrieves a valid authToken from an account.