MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / sso_extra_fields

Function sso_extra_fields

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

Source from the content-addressed store, hash-verified

23
24#[inline]
25fn sso_extra_fields(provider: SsoProvider) -> HashMap<&'static str, serde_json::Value> {
26 match provider {
27 SsoProvider::Facebook => [
28 (
29 "auth_endpoint",
30 "https://www.facebook.com/v9.0/dialog/oauth".into(),
31 ),
32 (
33 "token_endpoint",
34 "https://graph.facebook.com/v19.0/oauth/access_token".into(),
35 ),
36 (
37 "userinfo_endpoint",
38 "https://graph.facebook.com/v19.0/me?fields=id,name,email,first_name,last_name,picture".into(),
39 ),
40 ]
41 .into_iter()
42 .collect(),
43 SsoProvider::Google => [
44 (
45 "auth_endpoint",
46 "https://accounts.google.com/o/oauth2/v2/auth".into(),
47 ),
48 (
49 "token_endpoint",
50 "https://www.googleapis.com/oauth2/v3/token".into(),
51 ),
52 (
53 "userinfo_endpoint",
54 "https://openidconnect.googleapis.com/v1/userinfo".into(),
55 ),
56 ]
57 .into_iter()
58 .collect(),
59 SsoProvider::Discord => [
60 ("auth_endpoint", "https://discord.com/oauth2/authorize".into()),
61 ("token_endpoint", "https://discord.com/api/oauth2/token".into()),
62 ("userinfo_endpoint", "https://discord.com/api/users/@me".into()),
63 ]
64 .into_iter()
65 .collect(),
66 SsoProvider::GitHub => [
67 (
68 "auth_endpoint",
69 "https://github.com/login/oauth/authorize".into(),
70 ),
71 (
72 "token_endpoint",
73 "https://github.com/login/oauth/access_token".into(),
74 ),
75 ("userinfo_endpoint", "https://api.github.com/user".into()),
76 ]
77 .into_iter()
78 .collect(),
79 }
80}
81
82pub fn get_sso_fields(provider: SsoProvider) -> Option<HashMap<&'static str, serde_json::Value>> {

Callers 1

get_sso_fieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected