/// <summary> /// Initializes a new instance with the specified options. /// </summary> /// <param name="state">The state of the application.</param> /// <param name="scope">The scope of the application.</param> /// <param name="accessType">Whether the application should be enabled for offline access.</param> /// <param name="prompt">A list of prompts to present the user. If <see cref="GooglePromptOption.None"/>, the user will be prompted only the first time your app requests access.</param> public GoogleAuthorizeOptions(string state, GoogleScopeList scope, GoogleAccessType accessType, GooglePromptOption prompt) { State = state; Scope = scope; AccessType = accessType; Prompt = prompt; }
/// <summary> /// Gets the authorization URL at accounts.google.com for your application. /// </summary> /// <param name="state">The state of the application.</param> /// <param name="scope">The scope of the application.</param> /// <param name="accessType">Whether the application should be enabled for offline access. Default is online.</param> /// <param name="approvalPrompt">Whether the user should be re-prompted for scopes that he/she already has approved.</param> public string GetAuthorizationUrl(string state, string scope, GoogleAccessType accessType = GoogleAccessType.Online, GoogleApprovalPrompt approvalPrompt = GoogleApprovalPrompt.Auto) { return(GenerateUrl("https://accounts.google.com/o/oauth2/auth", new NameValueCollection { { "response_type", "code" }, { "client_id", ClientIdFull }, { "access_type", accessType.ToString().ToLower() }, { "approval_prompt", approvalPrompt.ToString().ToLower() }, { "scope", scope }, { "redirect_uri", RedirectUri }, { "state", state } })); }
/// <summary> /// Initializes a new instance with the specified options. /// </summary> /// <param name="state">The state of the application.</param> /// <param name="scope">The scope of the application.</param> /// <param name="accessType">Whether the application should be enabled for offline access.</param> public GoogleAuthorizeOptions(string state, string scope, GoogleAccessType accessType) { State = state; Scope = new GoogleScope(scope); AccessType = accessType; }
/// <summary> /// Initializes a new instance with the specified options. /// </summary> /// <param name="state">The state of the application.</param> /// <param name="scope">The scope of the application.</param> /// <param name="accessType">Whether the application should be enabled for offline access.</param> public GoogleAuthorizeOptions(string state, GoogleScopeList scope, GoogleAccessType accessType) { State = state; Scope = scope; AccessType = accessType; }
/// <summary> /// Gets the authorization URL at accounts.google.com for your application. /// </summary> /// <param name="state">The state of the application.</param> /// <param name="scope">The scope of the application.</param> /// <param name="accessType">Whether the application should be enabled for offline access. Default is online.</param> /// <param name="approvalPrompt">Whether the user should be re-prompted for scopes that he/she already has approved.</param> public string GetAuthorizationUrl(string state, GoogleScopeCollection scope, GoogleAccessType accessType = GoogleAccessType.Online, GoogleApprovalPrompt approvalPrompt = GoogleApprovalPrompt.Auto) { return GenerateUrl("https://accounts.google.com/o/oauth2/auth", new NameValueCollection { {"response_type", "code"}, {"client_id", ClientIdFull}, {"access_type", accessType.ToString().ToLower()}, {"approval_prompt", approvalPrompt.ToString().ToLower()}, {"scope", scope + ""}, {"redirect_uri", RedirectUri}, {"state", state} }); }