Unable to get refresh token

i am not able to get the refresh token , OAUth Problem= Signature invalid. The same code to generate the signature for the access token is being used but i keep getting this exception for refreshing the access token, while i am able to retrieve the access token succesfully