Getting 401 unauthorized error in /requests endpoint of Uber API - uber-api

I have tried using the /requests endpoint with my Uber developer account's owner and developer accounts, but I get this error:
401 unauthorized,
{
"message": "This endpoint requires at least one of the following scopes: request.delegate.tos_accept, request, request.delegate", "code": "unauthorized"
}
My HTTP call is as follows:
POST https://sandbox-api.uber.com/v1.2/requests
Headers:
Authorization: Bearer ACCESS_TOKEN_OF_MY_DEVELOPER_ACCOUNT
Accept-Language: en_US
Content-Type: application/json
Parameters:
{"start_latitude":"21.1741125","start_longitude":"72.8121804","end_latitude":"21.2048986","end_longitude":"72.8386455"}
Whereas I get proper response from /requests/estimate endpoint with the same access token, for the same location parameters.
Please help with this.

The problem is you have not requested the 'request' scope during the oauth authorization process.

Related

Github api returns bad credentials even with oauth token

update: even such a request get bad credential ==>
curl -H "Authorization: token [token]" https://api.github.com
===============
I made a request for GitHub OAuth like this in my iOS app:
URL: https://github.com/login/oauth/authorize,
params: client_id: ****, redirect_uri: app_url, scope: "repo", state: "0"
After redirection from Safari I get a code. I need to access to two things:
User data, like email and etc. Also updating user data.
List of repositories and commits in public and private repos.
I make following requests:
URL: https://api.github.com/user, get and patch
Header: Authorization: token [code]
URL: https://api.github.com/repos/:username/:repoName
Header: Authorization: token [code]
But unfortunately, I get the following error:
401, Unauthorized
{
"message": "Bad credentials",
"documentation_url": "https://developer.github.com/v3"
}
What is the problem and how can I solve it?
As it is said in this blob (NOT the main documentation) you have to exchange token (which is temporary) with a bearer token via this api:
the main api
Here comes the documentation for others:
Github blob documentation
The following curl command works:
curl -u your_git_name:your_personal_access_token https://api.github.com/user

Clio API v4 returns "User is forbidden from taking that action"

Clio API v4 returns ForbiddenError for every request.
For example this request works without problem:
GET /api/v2/users/who_am_i HTTP/1.1
Host: app.clio.com
Authorization: Bearer ***
And this request doesn't work:
GET /api/v4/users/who_am_i HTTP/1.1
Host: app.clio.com
Authorization: Bearer ***
This is the error returned with status 403:
{"error":{"type":"ForbiddenError","message":"User is forbidden from taking that action"}}
The same happens with any other request.
I was having the exact same problem. Here's a response from Clio, which resolved my issue.
We have recently made a change that requires all Bulk Action requests include bearer tokens in order to be successful. If you are making requests without including bearer tokens, they will fail.
Hope this helps.
I've found the solution.
The problem happened because the Bearer token has been received for application registered with APIv2 and/or in wrong domain (Europe instead of USA).
That means when I approved user I approved it against wrong application.

Getting HTTP 400 when requesting access token

I am trying link Actions on Google with a 3rd party service (non-Google). I am using Google Oauth 2.0 Playground to check if I am getting the auth code and the access token. I successfully received the auth code but when requesting the access token I am receiving the following result from the response.
HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain
WWW-Authenticate
I am not sure when I am doing wrong here. What does WWW-Authenticate mean?
Thanks in advance.

Playground authorization endpoint results in error: "insecure_transport"

First of all, great work. I donated because this could really save me lots of headaches. New to oauth2 and authentication in general. I signed up and registered # https://play.authlib.org/, added newapp. When I tried to authorize with the following uri:
https://play.authlib.org/oauth2/authorize?response_type=code&client_id=FhHzedZ9kdtQeTQRCwTgZELPdnHCEfEo7K0771U9XircD9Hh&state=e3dC66BGid2z0IwBinMgLKJ92IiD1r
it failed with:
{
"error": "insecure_transport",
"error_description": "OAuth 2 MUST utilize https."
}
Am I miss something?
There is nothing wrong with your code. The server itself has a bug (just fixed).
The playground is powered by Authlib v0.5 now.
You need to learn how to send requests for client_credentials:
https://www.rfc-editor.org/rfc/rfc6749#section-4.4.2
POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials

Cloud foundry API - stop application

I Need API to stop the running application, after some search I've found this API
http://apidocs.cloudfoundry.org/263/apps/updating_an_app.html
if I want to test it with postman how can I obtain token and where should I put it inside postman ?
Edit
i've tried like following with postman
Put
https://[api]/v2/apps/211c82e2-7316-45b6-9ae6-1df4dzz74772/stop
Header
Authorization : bearer <token>
"Content-Type":"application/x-www-form-urlencoded"
I got error:
{
"description": "Unknown request",
"error_code": "CF-NotFound",
"code": 10000
}
Any idea?
To get the token you can run cf oauth-token from the CLI.
You can use that token in Postman by adding an 'Authorization' HTTP header.
E.g.
Authorization: bearer token_you_got_by_running_cf_oauth-token