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

Method authorize

crates/opencode-server/src/oauth.rs:42–67  ·  view source on GitHub ↗
(
        loader: &PluginLoader,
        provider_id: &str,
        method: usize,
        inputs: Option<HashMap<String, String>>,
    )

Source from the content-addressed store, hash-verified

40 }
41
42 pub async fn authorize(
43 loader: &PluginLoader,
44 provider_id: &str,
45 method: usize,
46 inputs: Option<HashMap<String, String>>,
47 ) -> Result<Authorization, AuthError> {
48 let bridge = loader
49 .auth_bridge(provider_id)
50 .await
51 .ok_or_else(|| AuthError::OauthMissing(provider_id.to_string()))?;
52 let result = bridge
53 .authorize(method, inputs)
54 .await
55 .map_err(|_| AuthError::OauthCallbackFailed)?;
56
57 let method_type = match result.method.as_deref() {
58 Some("code") => AuthMethodType::Code,
59 _ => AuthMethodType::Auto,
60 };
61
62 Ok(Authorization {
63 url: result.url.unwrap_or_default(),
64 method: method_type,
65 instructions: result.instructions.unwrap_or_default(),
66 })
67 }
68
69 pub async fn callback(
70 &self,

Callers 1

plugin_auth_authorizeFunction · 0.45

Calls 1

auth_bridgeMethod · 0.80

Tested by

no test coverage detected