SorenLantz
SorenLantz

Reputation: 177

How to get oauth2 authorization with developer password for Uber API?

I am creating an app which only needs to access the Uber API with one account, mine. Is it possible to connect to the API with my account credentials? And if not, how else can I programmatically order rides through my account?

Upvotes: 0

Views: 265

Answers (2)

Miroslav T.
Miroslav T.

Reputation: 161

Regarding username and password authorization using Python code, please find some useful information here. Make sure that you have installed The Rides SDK. Package is open source, so you can find it on Github.

Please follow instructions for app authentication that can be found here.

To request a ride for a rider or to view a rider’s trip history, riders must grant access to your application through the OAuth 2.0 Authorization Code flow. See the Uber API docs on authentication for more information.

    from uber_rides.auth import AuthorizationCodeGrant
    auth_flow = AuthorizationCodeGrant(
        <CLIENT_ID>,
        <SCOPES>,
        <CLIENT_SECRET>,
        <REDIRECT_URI>
    )

auth_url = auth_flow.get_authorization_url()

Replace the values of each placeholder above: CLIENT_ID, CLIENT_SECRET, REDIRECT_URI and SCOPES. You can find these values in your developer dashboard under the your application’s Auth tab. The REDIRECT_URI must match the one of the values listed in your dashboard.

Have riders sign in and use the auth_url to grant access to your application. After authorization is complete, riders are redirected to the redirect_url. The redirect_url uses this format:

<REDIRECT_URI>?code=UNIQUE_AUTH_CODE

Hope this could help you!

All the best,

Upvotes: 2

SorenLantz
SorenLantz

Reputation: 177

The Uber Api does not support oauth2 with a username and password (at least not from python)

Upvotes: -1

Related Questions