A client library implementing the full v1 REST API protocol for Mastodon in Guile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7.1 KiB

auth Module

This module constructs the record which serves as a representation of a Mastodon client, holding the credentials which are used to authenticate with an instance's API (when said authentication is needed, as not all endpoints require authentication).


Table of Contents

  1. <mastodon-instance-application>
  2. masto-app-authorize-uri
  3. masto-app-domain
  4. masto-app-id
  5. masto-app-instantiate
  6. masto-app-key
  7. masto-app-name
  8. masto-app-redirects
  9. masto-app-scopes
  10. masto-app-secret
  11. masto-app-set-token-via-client-cred!
  12. masto-app-set-token-via-code!
  13. masto-app-set-token-via-user-cred!
  14. masto-app-token
  15. masto-app-verify-cred
  16. masto-app-website
  17. masto-instance-app?


<mastodon-instance-application>

Summary

A record object that can be returned by an API call.

Record Fields

domain
name
website
redirects
id
secret
key
scopes
token


masto-app-authorize-uri

Summary

Generates the URL to supply the user in order to display an authorization form to zem.

If no redirect URI is specified (via the redirect argument), the first of the specified redirect URIs stored in the app. record (mastoApp) will be used.

scopes, likewise, will default to the values stored in the app. record if no scopes are provided to the argument scopes for this function.

force will default to false if no value is specified.

Original Mastodon documentation of the HTTP call used for this process can be found here, under the "Authorize a user" section.

Parameters

#f03c15 mastoApp
#1589F0 #:redirect (argument position 2)
#1589F0 #:scopes (argument position 3)
#1589F0 #:force (argument position 4)


masto-app-domain

Summary

#f

Parameters

#f03c15 s


masto-app-id

Summary

#f

Parameters

#f03c15 s


masto-app-instantiate

Summary

Instantiate an application record for use with authentication.

Only an instance domain is required; if no client ID, secret, or key are provided, a client is registered at the specified instance; to avoid registering a new client and use an existing one, all three must be provided.

name, redirects, and scopes default to – respectively – "Elefan", '("urn:ietf:wg:oauth:2.0:oob"), and '("read"), if not provided for.

Original Mastodon documentation of the HTTP call used for this process can be found here, under the "Create an application" section.

To learn more about scopes, visit here.

Parameters

#f03c15 domain
#1589F0 #:website (argument position 2)
#1589F0 #:id (argument position 3)
#1589F0 #:secret (argument position 4)
#1589F0 #:key (argument position 5)
#1589F0 #:name (argument position 6)
#1589F0 #:redirects (argument position 7)
#1589F0 #:scopes (argument position 8)


masto-app-key

Summary

#f

Parameters

#f03c15 s


masto-app-name

Summary

#f

Parameters

#f03c15 s


masto-app-redirects

Summary

#f

Parameters

#f03c15 s


masto-app-scopes

Summary

#f

Parameters

#f03c15 s


masto-app-secret

Summary

#f

Parameters

#f03c15 s


masto-app-set-token-via-client-cred!

Summary

#f

Parameters

#f03c15 mastoApp
#c5f015 [scopes]


masto-app-set-token-via-code!

Summary

Obtain a token (to store in your mastoApp record object) via a user authorization code, obtained via masto-app-authorize-uri.

If no redirect URI is specified (via the redirect argument), the first of the specified redirect URIs stored in the app. record (mastoApp) will be used.

Original Mastodon documentation of the HTTP call used for this process can be found here, under the "Obtain a token" section.

Parameters

#f03c15 mastoApp
#f03c15 code
#c5f015 [redirect]


masto-app-set-token-via-user-cred!

Summary

#f

Parameters

#f03c15 mastoApp
#f03c15 username
#f03c15 password
#c5f015 [scopes]


masto-app-token

Summary

#f

Parameters

#f03c15 s


masto-app-verify-cred

Summary

Confirm that the app's OAuth2 credentials stored in the record work.

Original Mastodon documentation of the HTTP call used for this process can be found here, under the "Verify your app works" section.

Parameters

#f03c15 mastoApp


masto-app-website

Summary

#f

Parameters

#f03c15 s


masto-instance-app?

Summary

#f

Parameters

#f03c15 obj