How to use Jenkins github user credentials to access github api in my script?
You want the Credentials Plugin.

The administrator of the Jenkins instance can add the plugin, then add the credential (access token) that the job needs. Then, in the job, use the credential as a variable.

See the documentation for more details.