Problem: The redirect URI is double-encoded that is I am passing https%253A%252F%252Fdev10.ritepush.com%252Fdashboard
, which decodes to https%3A%2F%2Fdev10.ritepush.com%2Fdashboard
. I must encode the uri once that is I need to pass https%3A%2F%2Fdev10.ritepush.com%2Fdashboard
.
Reason: PHP encodes http requests automatically hence upon applying urlencode
to the redirect_uri
, I am actually encoding the redirect URI twice but it is decoded only once. Therefore, the encode URI is passed in the request body which results in the error.
Thanks to David Chatenay from Feedly for pointing out the error.