MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / get_sso_fields

Function get_sso_fields

aiscript-runtime/src/config/sso.rs:82–121  ·  view source on GitHub ↗
(provider: SsoProvider)

Source from the content-addressed store, hash-verified

80}
81
82pub fn get_sso_fields(provider: SsoProvider) -> Option<HashMap<&'static str, serde_json::Value>> {
83 let config = &Config::get().sso;
84 let sso_provider = match provider {
85 SsoProvider::Facebook => config.facebook.as_ref(),
86 SsoProvider::Google => config.google.as_ref(),
87 SsoProvider::Discord => config.discord.as_ref(),
88 SsoProvider::GitHub => config.github.as_ref(),
89 }?;
90
91 let mut fields: HashMap<&'static str, serde_json::Value> = [
92 (
93 "client_id",
94 serde_json::Value::String(sso_provider.client_id.to_string()),
95 ),
96 (
97 "client_secret",
98 serde_json::Value::String(sso_provider.client_secret.to_string()),
99 ),
100 (
101 "redirect_url",
102 serde_json::Value::String(sso_provider.redirect_url.to_string()),
103 ),
104 (
105 "scopes",
106 serde_json::Value::Array(
107 sso_provider
108 .scopes
109 .iter()
110 .map(|v| serde_json::Value::String(v.to_string()))
111 .collect(),
112 ),
113 ),
114 ]
115 .into_iter()
116 .collect();
117
118 fields.extend(sso_extra_fields(provider));
119
120 Some(fields)
121}

Callers 1

pollMethod · 0.85

Calls 3

getFunction · 0.85
sso_extra_fieldsFunction · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected