- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::oauth::GitHub
::xo::oauth::GitHub create ... \Tailored OAuth handler for GitHub
[ -after_successful_login_url (default "/pvt/") ] \
[ -base_url (default "https://github.com/login/oauth") ] \
[ -client_id client_id ] \
[ -client_secret client_secret ] \
[ -create_not_registered_users:boolean (default "false") ] \
[ -create_with_dotlrn_role (default "") ] \
[ -debug:boolean (default "false") ] \
[ -login_failure_url (default "/") ] \
[ -pretty_name (default "GitHub") ] \
[ -responder_url (default "/oauth/github-login-handler") ] \
[ -scope (default "read:user user:email") ]
Defined in packages/xooauth/tcl/authorize-procs.tcl
Class Relations
::nx::Class create ::xo::oauth::GitHub \ -superclass ::xo::AuthorizeMethods (to be applied on instances)
get_user_data (scripted, public)
<instance of xo::oauth::GitHub> get_user_data [ -token token ] \ [ -required_fields required_fields ]Get user data based on the temporary code (passed via "-token") provided by GitHub. First, convert the temporary code into an access_token, and use this to get the user data.
- Switches:
- -token (optional)
- -required_fields (optional, defaults to
" {email email} {name name} "
)- Testcases:
- No testcase defined.
set data [:redeem_code $token] ns_log notice "[self] redeem_code returned keys: [lsort [dict keys $data]]" set result $data if {[dict exists $data access_token]} { # # When we received the access_token, we have no error # so far. # set access_token [dict get $data access_token] #ns_log notice "[self] redeemed form data: $access_token" set result [:get_api_data $access_token] ns_log notice "[self] get_user_data: get_api_data contains error:" [dict exists $result error] if {![dict exists $result error]} { set data [:get_required_fields -claims [dict get $result claims] -mapped_fields { {email email} {name name} }] if {[dict exists $data error]} { set result [dict merge $data $result] } else { set result [dict merge $result [dict get $data fields]] # # We have still to split up "name" into its # components, since GitHub does not provide # the exactly needed fields. Actually, we need # this just for creating a new user_id, so it # might not be always needed. # set first_names [join [lrange [dict get $result name] 0 end-1] " "] set last_name [lindex [dict get $result name] end] dict set result first_names $first_names dict set result last_name $last_name } } } ns_log notice "[self] get_user_data returns $result" return $resultlogout_url (scripted, public)
<instance of xo::oauth::GitHub> logout_url \ [ -return_url return_url ]Returns the URL for logging out. E.g., GitHub has no logout, so provide simply a redirect URL (maybe, we should logout from the application?)
- Switches:
- -return_url (optional)
- Testcases:
- No testcase defined.
return $return_url
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables