We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to refresh a token , i dont know please help me to get new token.
i am integrating to uber. the below code working fine. My code:
SharedPreferencesCredentialStore credentialStore = new SharedPreferencesCredentialStore(this, "preferenceFileName", new JacksonFactory());
AuthorizationFlow.Builder builder = new AuthorizationFlow.Builder( BearerToken.authorizationHeaderAccessMethod(), AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new GenericUrl("https://login.uber.com/oauth/token"), new ClientParametersAuthentication("ADQjXcw8g7IG2d_wS2Yb0k0KA9YwKvYS", "7R3GUDd-wW4Obtis9fKNkhvYL6t9Mz9hb3Z5Je5w"), "ADQjXcw8g7IG2d_wS2Yb0k0KA9YwKvYS", "https://login.uber.com/oauth/authorize"); builder.setCredentialStore(credentialStore); ArrayList<String> scopes = new ArrayList<>(); scopes.add("profile"); scopes.add("places"); // scopes.add("request"); builder.setScopes(scopes); AuthorizationFlow flow = builder.build(); AuthorizationUIController controller = new DialogFragmentController(getFragmentManager()) { @Override public String getRedirectUri() throws IOException { return "https://grabbngo"; } @Override public boolean isJavascriptEnabledForWebView() { return false; } @Override public boolean disableWebViewCache() { return false; } @Override public boolean removePreviousCookie() { return false; } }; OAuthManager oauth = new OAuthManager(flow, controller); OAuthManager.OAuthCallback<Credential> callback = new OAuthManager.OAuthCallback<Credential>() { @Override public void run(OAuthManager.OAuthFuture<Credential> future) { try { Credential credential = future.getResult(); //credential.getRefreshToken(); getUberStuff(credential.getAccessToken()); } catch (Exception e) { e.printStackTrace(); } } }; oauth.authorizeImplicitly("userId", callback, new Handler()); }
void getUberStuff(final String token) throws AuthFailureError { StringRequest stringRequest = new StringRequest(Request.Method.GET, "https://api.uber.com/v1/me", new Response.Listener() { @OverRide public void onResponse(String response) { Log.wtf("uresp", response); try { JSONObject jo = new JSONObject(response); String img = jo.getString("picture"); String fname = jo.getString("first_name"); String lname = jo.getString("last_name"); String uuid = jo.getString("uuid"); String rider_id = jo.getString("rider_id"); String email = jo.getString("email");
prefs.edit().putString("lid", rider_id).putString("profileimg", img).putString("email", email). putString("fname", fname).putString("lname", lname). putString("token", token). putString("source", "uber").commit(); startActivity(new Intent(Step1Activity.this, Step2Activity.class)); Step1Activity.this.finish(); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.wtf("uerr", error.toString()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<>(); params.put("Authorization", "bearer " + token); return params; } }; MyApp.q.add(stringRequest); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How to refresh a token , i dont know please help me to get new token.
i am integrating to uber.
the below code working fine.
My code:
SharedPreferencesCredentialStore credentialStore =
new SharedPreferencesCredentialStore(this,
"preferenceFileName", new JacksonFactory());
void getUberStuff(final String token) throws AuthFailureError {
StringRequest stringRequest = new StringRequest(Request.Method.GET, "https://api.uber.com/v1/me",
new Response.Listener() {
@OverRide
public void onResponse(String response) {
Log.wtf("uresp", response);
try {
JSONObject jo = new JSONObject(response);
String img = jo.getString("picture");
String fname = jo.getString("first_name");
String lname = jo.getString("last_name");
String uuid = jo.getString("uuid");
String rider_id = jo.getString("rider_id");
String email = jo.getString("email");
The text was updated successfully, but these errors were encountered: