uber / uber/rides-android-sdk

"No authentication provided.",Internal Server Error.

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
293
Forks
132
PR merge metrics
No merged PRs in 30d

Description

Github issues are for bug reports. If this is a question around usage or understanding please use
Stack Overflow. https://stackoverflow.com/questions/tagged/uber-api

Library version:0.9.1

Repro steps, stacktrace, screenshots:

// .............initial ubar sdk................
private void initializeUber() {
if (!UberSdk.isInitialized()) {
config = new SessionConfiguration.Builder()
// mandatory
.setClientId(Authentication.Clint_id)
.setClientSecret(Authentication.Clint_secrect)
// required for enhanced button features
.setServerToken(Authentication.Server_token)
// required for implicit grant authentication
.setRedirectUri(Authentication.Redirect_uri)
// optional: set sandbox as operating environment
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.setScopes(Arrays.asList(Scope.PROFILE, Scope.RIDE_WIDGETS, Scope.REQUEST, Scope.REQUEST_RECEIPT, Scope.ALL_TRIPS))
.build();
UberSdk.initialize(config);
}
}

public void AuthorizationAccess() {

    LoginCallback loginCallback = new LoginCallback() {
        @Override
        public void onLoginCancel() {
            // User canceled login
            Toast.makeText(getApplicationContext(), "User canceled login", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onLoginError(@NonNull AuthenticationError error) {
            // Error occurred during login
            Toast.makeText(getApplicationContext(), "Error occurred during login", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onLoginSuccess(@NonNull AccessToken accessToken) {
            // Successful login!  The AccessToken will have already been saved.
            Toast.makeText(getApplicationContext(), "Successful login!  The AccessToken will have already been saved.", Toast.LENGTH_SHORT).show();
            createSession();
        }

        @Override
        public void onAuthorizationCodeReceived(@NonNull String authorizationCode) {
            Toast.makeText(getApplicationContext(), "Authorization code received", Toast.LENGTH_SHORT).show();
            createSession();
        }
    };
    AccessTokenManager accessTokenManager = new AccessTokenManager(getApplicationContext());
    LoginManager loginManager = new LoginManager(accessTokenManager, loginCallback, config, requestCode);
    loginManager.setAuthCodeFlowEnabled(true);
    loginManager.login(this);
    mAccessTokenManager = accessTokenManager;
    mLoginManager = loginManager;

}

private void createSession() {
    try {
        AccessToken accessToken = mAccessTokenManager.getAccessToken();
        String s = String.valueOf(accessToken);
        Log.d("tag", s);
        Session session = mLoginManager.getSession();
        service = UberRidesApi.with(session).build().createService();
        service.getUserProfile().enqueue(new Callback<UserProfile>() {
            @RequiresApi(api = Build.VERSION_CODES.KITKAT)
            @Override
            public void onResponse(@NonNull Call<UserProfile> call, @NonNull Response<UserProfile> response) {
                Log.i(TAG, response.toString());
                if (response.isSuccessful()) {
                    //Success

                    Toast.makeText(getApplicationContext(), "i am here", Toast.LENGTH_LONG).show();
                    UserProfile profile = response.body();
                    Log.d(TAG, Objects.requireNonNull(profile).getFirstName());


                } else {
                    //Api Failure
                    ApiError error = ErrorParser.parseError(response);
                    assert error != null;
                    for (int i = 0; i < error.getClientErrors().size(); i++) {
                        Log.i(TAG, error.getClientErrors().get(i).getTitle());
                        Log.d("tag", "i am here with api error");
                        Toast.makeText(getApplicationContext(), "i am here with api error", Toast.LENGTH_LONG).show();
                    }

                }
            }

            @Override
            public void onFailure(Call<UserProfile> call, Throwable t) {
                //Network Failure
                Log.d("tag", "i am here with net fail");
                Toast.makeText(getApplicationContext(), "i am here with api error2", Toast.LENGTH_LONG).show();
            }
        });
    } catch (Exception ex) {
        Log.d("uber", "failed creat profile");
        Toast.makeText(getApplicationContext(), "i am here with api error3", Toast.LENGTH_LONG).show();
    }

}

Expected Behavior:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Java initialization, login, and createSession flow with rides-android-sdk 0.9.1, then inspect the access token and session used by service.getUserProfile(). Compare the request result with the reported "No authentication provided" error. Done means the profile request authenticates successfully or the missing authentication requirement is documented with a confirmed cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
api, authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.