canvas::API method token (public)

 <instance of canvas::API[i]> token [ -grant_type grant_type ] \
    [ -scope scope ] [ -assertion assertion ] \
    [ -client_assertion_type client_assertion_type ] \
    [ -requested_token_use requested_token_use ]

Defined in packages/xooauth/tcl/canvas-procs.tcl

Get bearer token (access token) from the /oauth2/v2.0/token endpoint. https://canvas.instructure.com/doc/api/file.oauth_endpoints.html#post-login-oauth2-token

Switches:
-grant_type (optional, defaults to "client_credentials")
-scope (optional)
-assertion (optional)
-client_assertion_type (optional, defaults to "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
-requested_token_use (optional)

Testcases:
No testcase defined.
Source code:
#error "not implemented yet"

#
# Get the access-token from /token endpoint.
#
set r [:request -method POST  -content_type "application/x-www-form-urlencoded"  -vars {
               {client_secret ${:client_secret}}
               {client_id ${:client_id}}
               scope
               grant_type
               assertion
               client_assertion_type
               requested_token_use
           }  -url ${:baseurl}/login/oauth2/token]

ns_log notice "/token POST Request Answer: $r"
#
# Current errors:
#   assertion method not supported for this grant_type"
#   <h1>Page Error</h1> <p>Something broke unexpectedly.
#
#return $access_token
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: