How to decode base64 url in python?

前端 未结 9 1495
一个人的身影
一个人的身影 2020-12-28 15:24

For Facebook fbml Apps Facebook is sending in a signed_request parameter explained here:

http://developers.facebook.com/docs/authentication/canvas

They have

9条回答
  •  滥情空心
    2020-12-28 15:40

    Alternative to @dae.eklen's solution, you can append === to it:

    s = 'iEPX-SQWIR3p67lj_0zigSWTKHg'
    base64.urlsafe_b64decode(s + '===')
    

    This works because Python only complains about missing padding, but not extra padding.

提交回复
热议问题