Railgun

if it ain't broke, we'll break it

User Tools

Site Tools


senses:types:auth

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

senses:types:auth [2025/07/28 00:32] – created flashsenses:types:auth [2025/07/28 00:37] (current) – added example flash
Line 12: Line 12:
  
 The token_type field contains the type string of the token, used for the first part of a [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Authorization|HTTP Authorization]] header. The token_type field contains the type string of the token, used for the first part of a [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Authorization|HTTP Authorization]] header.
 +
 +While the value of this field is likely always to be the string ''Bearer'', you should still use this field in your format string in case there are any changes to this in the future.
  
 ===== expires_in ===== ===== expires_in =====
Line 20: Line 22:
  
 The optional scope field contains the scope string for the access_token if it differed from the scope the Komeiji runtime requested with the authorization server. The optional scope field contains the scope string for the access_token if it differed from the scope the Komeiji runtime requested with the authorization server.
 +
 +===== Example =====
 +
 +This example sends a HTTP request to an arbitrary endpoint using Satori's access token.
 +
 +  local http = require('kmj-http')
 +  local auth = satori.getAuthToken()
 +  local result = http.get('https://flashii.net/api/v1/beans', {
 +      timeout = 5000,
 +      type = 'json',
 +      requestHeaders = {
 +          ['Authorization'] = string.format('%s %s', auth.token_type, auth.access_token)
 +      }
 +  })
senses/types/auth.txt · Last modified: by flash