[英]Oauth2 & Laravel - `Client_id` & `Client_secret` - where to place, store, call?
[英]how to store 'client_secret' and 'client_id' on Android app when using OAuth?
我正在為現有網站開發一個Android應用程序,所以我開發登錄部分到一個Android應用程序,我使用oAuth protocol.i有用戶數據的API,並從網站生成client_id
和client_secret_key
。所以我的問題是。
client_id
和client_secret
(在移動應用程序或任何支持的客戶端Web服務中) 該網站建立在larevel php框架上。
要回答第一個問題,請使用共享首選項。 共享首選項允許您以鍵,值對的形式保存和檢索數據。 第二個問題,從共享首選項中讀取並將結果發送回Web服務器。 檢查是否存在數據,然后獲取值,驗證並相應地傳輸。 我建議使用這個很棒的庫作為你的問題的獎勵.retrofit2。
如果要在應用程序中安全地保存ID,可以使用密鑰庫。
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
// get user password and file input stream
char[] password = getPassword();
java.io.FileInputStream fis = null;
try {
fis = new java.io.FileInputStream("keyStoreName");
ks.load(fis, password);
} finally {
if (fis != null) {
fis.close();
}
}
https://developer.android.com/reference/java/security/KeyStore.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.