簡體   English   中英

在GAE客戶端上使用OAuth 2.0(身份驗證)令牌

[英]Using OAuth 2.0 (Authentication) token on GAE client

我正在尋找為我的客戶提供安全性的最佳方法[web-java腳本/ mob-android應用],以便授權用戶/機器只能訪問我的應用。 在google上搜索時,我發現可以使用google提供的OAuth 2.0進行授權,

[1]建議使用OAuth 2.0嗎?

在OAuth 2.0用戶在首先我們必須使用創建客戶端令牌谷歌的控制台 ,可以使用客戶端ID在Java腳本客戶給這里

[2]在Web客戶端上,令牌存儲在哪里?

開發者網站上,他們給了

You should write your code to anticipate the possibility that a granted token might no longer work. A token might stop working for one of these reasons:

The user has revoked access.
The token has not been used for six months.
The user account has exceeded a certain number of token requests.
There is currently a 25-token limit per Google user account. If a user account has 25 valid tokens, the next authentication request succeeds, but quietly invalidates the oldest outstanding token without any user-visible warning.

If you need to authorize multiple programs, machines, or devices, one workaround is to limit the  number of clients that you authorize per user account to 15 or 20. If you are a Google Apps admin, you can create additional admin users and use them to authorize some of the clients.

使用oAuth2.0,我需要擁有goole,facebook帳戶或從我的自定義域帳戶說www.mysite.com/usr1我可以進行身份​​驗證?

問題

[3]令牌生成后,我們可以控制其生命周期(如何?),或者僅在六個月后過期?

[4]對於每個Google帳戶用戶,我可以生成25個令牌?對於我的google帳戶(用於創建控制台項目的帳戶),我可以生成25個令牌?

[5]同一令牌可用於多個Web客戶端用戶嗎?

訪問令牌的壽命有限。 如果您的應用程序需要在單個訪問令牌的生存期之外訪問Google API,則可以獲取刷新令牌。 刷新令牌使您的應用程序可以獲得新的訪問令牌。

[6] Access令牌與我從控制台生成的令牌相同嗎?

[7]從哪里可以獲得刷新令牌?

任何幫助將不勝感激!!!

提前致謝

我使用oauth,oauth2和openid在我的GAE python應用程序上對我的用戶進行身份驗證,實現起來並不是很簡單,但是對於訪問者來說卻非常有用和簡單。

首先,您可以使用oauth 2.0游樂場嘗試使用oauth: https//developers.google.com/oauthplayground/

  1. 是!
  2. 在餅干中。 為了保護您的用戶,我建議使用Cloudflare pro獲取帶有您的域名的https網址。 與購買證書相比,成本非常低,並且您可以使用更多的服務來加快應用程序的速度。
  3. 在python中,您可以定義生存時間,在Java中,我想是相同的。
  4. 令牌在有效期內和特定域有效。
  5. 請參閱第4點。您可以請求更新令牌。
  6. 我不知道,請使用Playground工具進行測試。
  7. 我不明白你的問題。 如果您的應用程序需要向提供者請求數據並且令牌已過期,則需要使用刷新鍵來請求新令牌。

有關Python的信息,請邀請您訪問此庫: https : //github.com/scotch/engineauth

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM