pub struct BeginAuthResult {
pub auth_url: String,
pub state: StateParam,
}Expand description
Result of initiating OAuth authorization.
This struct contains the authorization URL to redirect users to and the state parameter that should be persisted (typically in a session or cookie) for verification when the callback is received.
§Important
The state value must be stored by your application and passed to
validate_auth_callback
when handling the callback. This is essential for CSRF protection.
§Example
ⓘ
let result = begin_auth(&config, &shop, "/callback", true, None)?;
// Store in session (implementation depends on your web framework)
session.set("oauth_state", result.state.as_ref());
// Redirect to Shopify
return Redirect::to(&result.auth_url);Fields§
§auth_url: StringThe full authorization URL to redirect the user to.
This URL points to Shopify’s OAuth authorization endpoint with all required query parameters.
state: StateParamThe state parameter generated for this authorization request.
Store this value and compare it against the state parameter
in the OAuth callback to prevent CSRF attacks.
Trait Implementations§
Source§impl Clone for BeginAuthResult
impl Clone for BeginAuthResult
Source§fn clone(&self) -> BeginAuthResult
fn clone(&self) -> BeginAuthResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BeginAuthResult
impl RefUnwindSafe for BeginAuthResult
impl Send for BeginAuthResult
impl Sync for BeginAuthResult
impl Unpin for BeginAuthResult
impl UnwindSafe for BeginAuthResult
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