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

Function authority_url

aiscript-vm/src/builtins/sso.rs:127–142  ·  view source on GitHub ↗
(
    state: &mut State<'gc>,
    _args: Vec<Value<'gc>>,
)

Source from the content-addressed store, hash-verified

125}
126
127fn authority_url<'gc>(
128 state: &mut State<'gc>,
129 _args: Vec<Value<'gc>>,
130) -> Result<Value<'gc>, VmError> {
131 let mut fields = parse_auth_fields(state)?;
132 let scopes = mem::take(&mut fields.scopes);
133 // Generate the authorization URL to which we'll redirect the user.
134 let (authorize_url, _csrf_state) = get_client(fields)
135 .authorize_url(CsrfToken::new_random)
136 .add_scopes(scopes)
137 .url();
138
139 Ok(Value::String(
140 state.intern(authorize_url.as_str().as_bytes()),
141 ))
142}
143
144fn verify<'gc>(state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {
145 let mut i = 0;

Callers

nothing calls this directly

Calls 5

parse_auth_fieldsFunction · 0.85
get_clientFunction · 0.85
as_bytesMethod · 0.80
internMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected