how to login to jenkins with third party sso from python scripts

1,533 views
Skip to first unread message

Sushant Gupta

unread,
Jun 17, 2015, 3:20:28 AM6/17/15
to jenkins...@googlegroups.com
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant

Khai Do

unread,
Jul 15, 2015, 1:24:37 AM7/15/15
to jenkins...@googlegroups.com
It looks like Jenkins supports access with an API token[1] .  Unfortunately python-jenkins doesn't provide the ability to pass an API token when connecting to jenkins.  But it does seem like what you are asking for is possible.  I would suggest you enter a bug in the python-jenkins issue tracker for this feature.  You never know :)  

Khai Do

unread,
Jul 17, 2015, 2:09:03 AM7/17/15
to jenkins...@googlegroups.com
Actually I am wrong.  python-jenkins does allow users to pass a token when connecting to jenkins.   You can just pass the username and token to authenticate, just replace the password with the token and it should work, like so..

j = jenkins.Jenkins('http://your_url_here', 'username', '0d571a048e1f707f306cb52a44a5f706')

Lokeshwaran

unread,
Jun 24, 2020, 12:53:10 AM6/24/20
to Jenkins Users
Where do we get this API token from

Richard Bywater

unread,
Jun 24, 2020, 1:01:47 AM6/24/20
to jenkins...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2e41317c-832c-460b-9bbd-4220dc850b60o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages