MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / parsed_config

Method parsed_config

crates/opencode-mcp/src/oauth.rs:83–121  ·  view source on GitHub ↗

Validate config and return parsed URL components.

(
        &self,
    )

Source from the content-addressed store, hash-verified

81
82 /// Validate config and return parsed URL components.
83 fn parsed_config(
84 &self,
85 ) -> Result<
86 (
87 ClientId,
88 Option<ClientSecret>,
89 AuthUrl,
90 TokenUrl,
91 RedirectUrl,
92 ),
93 OAuthError,
94 > {
95 let client_id = self
96 .config
97 .client_id
98 .as_deref()
99 .ok_or_else(|| OAuthError::Config("client_id is required".into()))?;
100
101 let auth_url = AuthUrl::new(self.config.auth_url.clone())
102 .map_err(|e| OAuthError::Config(format!("invalid auth_url: {e}")))?;
103 let token_url = TokenUrl::new(self.config.token_url.clone())
104 .map_err(|e| OAuthError::Config(format!("invalid token_url: {e}")))?;
105 let redirect_url = RedirectUrl::new(self.config.redirect_uri.clone())
106 .map_err(|e| OAuthError::Config(format!("invalid redirect_uri: {e}")))?;
107
108 let secret = self
109 .config
110 .client_secret
111 .as_ref()
112 .map(|s| ClientSecret::new(s.clone()));
113
114 Ok((
115 ClientId::new(client_id.to_string()),
116 secret,
117 auth_url,
118 token_url,
119 redirect_url,
120 ))
121 }
122 /// Start the authorization flow.
123 ///
124 /// Returns the URL the user should open in a browser. The PKCE verifier

Callers 3

start_authMethod · 0.80
finish_authMethod · 0.80
refresh_tokenMethod · 0.80

Calls 3

ConfigClass · 0.85
newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected