kamalogudah / ganji

Kenyan Payments
MIT License
0 stars 1 forks source link

Authentication #1

Open kamalogudah opened 5 years ago

kamalogudah commented 5 years ago

To make an API call to mpesa api, you will need to authenticate your app. Safaricom have provided an OAuth API for you to generate an access token, it supports client_credentials grant type. To authorize your API call to the OAuth API, you will need a Basic Auth over HTTPS authorization token. The Basic Auth string is a base64 encoded string of your app’s client key and client secret. There is need to use a base64 library to build the gem to get the Basic Auth string that you will then use to invoke mpesa's OAuth API to get an access token. Checkout the documentation here

mboya commented 5 years ago

@kamalogudah you can also have a look at this https://github.com/mboya/mpesa_stk/blob/master/lib/mpesa_stk/access_token.rb hope it helps.