pub enum AdditionalScope {
Email,
Profile,
Both,
None,
}Expand description
Optional Scope Parameters
In an OpenID Connect authentication request, the scope parameter specifies the type of user information
that should be included in the ID token. By default, the openid scope is required for authentication.
This enum allows adding optional scopes, such as email, profile, or both, to the request.
§Purpose
AdditionalScope is used to extend the default scope parameter when creating a CodeRequest.
It enables applications to request additional user information from Google.
§Variants
§Email
- Requests the user’s email address and email verification status.
- This is useful if the application needs to identify the user by their email address.
§Profile
- Requests the user’s name, profile picture URL, and other basic profile information.
- This is useful for displaying user details in the application.
§Both
This allows you to add both Email and Profile scopes
§None
No additional scopes are added
§Example
use crate::code::AdditionalScope;
let additional_scopes = AdditionalScope::Both;
let request = CodeRequest::new(true, &config, additional_scopes, &csrf_token, &nonce);
let url = request.into_url().unwrap();
println!("Authorization URL: {}", url);If no additional scopes are specified, the request will only include openid, which is required for authentication.
§Notes
- Adding
emailorprofilescopes allows the application to access more detailed user information. - Ensure that the requested scopes align with the application’s privacy policy and user consent.
Variants§
Trait Implementations§
Source§impl Clone for AdditionalScope
impl Clone for AdditionalScope
Source§fn clone(&self) -> AdditionalScope
fn clone(&self) -> AdditionalScope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdditionalScope
impl Debug for AdditionalScope
Source§impl PartialEq for AdditionalScope
impl PartialEq for AdditionalScope
Source§fn eq(&self, other: &AdditionalScope) -> bool
fn eq(&self, other: &AdditionalScope) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AdditionalScope
Auto Trait Implementations§
impl Freeze for AdditionalScope
impl RefUnwindSafe for AdditionalScope
impl Send for AdditionalScope
impl Sync for AdditionalScope
impl Unpin for AdditionalScope
impl UnsafeUnpin for AdditionalScope
impl UnwindSafe for AdditionalScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more