added url encoding for redirect_uri and scope parameters.