Authorization for github.com on Android

前端 未结 3 1466
遇见更好的自我
遇见更好的自我 2021-01-01 06:23

Help me please. I make client for android for github.com api v3 and i have a trouble with authorization. (login = mytest12345 , pass = 12345test)

http://developer.g

3条回答
  •  悲&欢浪女
    2021-01-01 06:58

    I know you want it in Java, but you might be interested in an answer I just provided to another question for further Python examples.

    In order to authenticate I had to specifically state the type of authentication (what follows is Python code):

    base64string = base64.encodestring('%s:%s' % (username, passwd)).replace('\n', '')
    req.add_header("Authorization", "Basic %s" % base64string)
    

    But it doesn't appear that you are adding the "Basic " prefix. Try adding that in and seeing if you get any success.

提交回复
热议问题