有沒有人有任何使用Google Client API
來通過限制用戶可以登錄的域來授權他們的域名的經驗?Google客戶端API - 將oauth身份驗證限制到我的域名
所需的珍品似乎是一個QS參數:hd='[Domain name]'
但沒有什麼相似的OAuth2Parameters
參數對象
var oap = new OAuth2Parameters
{
AccessToken = Current == null ? null : Current.AccessToken,
RefreshToken = Current == null ? null : Current.RefreshToken,
ClientId = GoogleClientId,
ClientSecret = GoogleClientSecret,
Scope = "https://spreadsheets.google.com/feeds https://docs.google.com/feeds https://www.googleapis.com/auth/userinfo.email",
RedirectUri = HttpContext.Current.Request.Url.Scheme.Concatenate("://", HttpContext.Current.Request.Url.Authority, "/Builder/Authentication/Receive"),
AccessType = "offline" //ensures a refresh token (tho not currently working),
*HD = //Hmm if only... :(((*
};
var authorizationUrl = OAuthUtil.CreateOAuth2AuthorizationUrl(oap);
return Redirect(authorizationUrl);
哈哈,你馬上回答你自己的問題嗎?不妨將其標記爲已接受。 :-P –
用戶不能只修改重定向網址,並添加自己的域名? – Tyguy7