android authenticatorいついて少々 #potatotips
TRANSCRIPT
![Page 1: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/1.jpg)
Android Authenticator について少々
#potatotips 2014/4/9 at UIEvolution
by FUJI, Goro (gfx) at cookpad.com
![Page 2: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/2.jpg)
![Page 3: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/3.jpg)
Android Authenticator
Androidのアカウントを扱うしくみ
「Twitterでログインする」みたいなしくみを提供(a.k.a. SSO)
iOSでTwitter/Facebookが特別扱いされているアレを汎用的にしたもの
![Page 4: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/4.jpg)
Android Account Manager
HOME\Settings\ACCOUNTS
「アカウントと同期」と書いてあったりしますが、単なるアカウント管理にも使えます
プログラムからは AccountManager と
AbstractAccountAuthenticator でアクセスする
![Page 5: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/5.jpg)
SSO with Twitter
client appからAccountManager#getAuthToken()
でtokenをとれる
getAuthToken()をすると、Android OSを経てauthenticator appに制御がわたり、いろいろ処理した後 client app に制御がもどる
![Page 6: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/6.jpg)
Client Authenticator
Android Account Manager
![Page 7: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/7.jpg)
ところで…
Twitter Developer用のキーとかなくてもとれるんだけどこのauth tokenと auth secretって何?
これが何かはauthenticatorが決められるのでAbstractAccountAuthenticatorのサブクラスを実装すればなんでも返せる
![Page 8: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/8.jpg)
Repository
https://github.com/gfx/Android-SNS-SignIn
色気をだしてAndroid-Boltsを使ってみたけどかえってわかりにくくなってしまったかも💦
![Page 9: Android Authenticatorいついて少々 #potatotips](https://reader034.vdocuments.site/reader034/viewer/2022052505/556156ffd8b42a780d8b53fb/html5/thumbnails/9.jpg)
We Are Hiring
Android/iOSエンジニア募集中 at COOKPAD