For the RideRequestWidget I have the following Code
RideParameters rideParams = new RideParameters.Builder()
.setProductId("83941b0d-4be1-4979-a9c0-f0af5ee2b89b")
.setPickupLocation(19.1136, 72.8679, "Uber HQ", "1455 Market Street, San Francisco")
.setDropoffLocation(19.1145, 72.8675, "Embarcadero", "One Embarcadero Center, San Francisco")
.build();
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId(AppController.UBER_CLIENT_ID)
.setServerToken(AppController.UBER_SERVER_TOKEN)
.build();
ServerTokenSession session = new ServerTokenSession(config);
holder.uberButton.setRideParameters(rideParams);
holder.uberButton.setRequestBehavior(new RideRequestActivityBehavior((Activity) mContext, 1234));
holder.uberButton.setSession(session);
holder.uberButton.setCallback(callback);
holder.uberButton.loadRideInformation();
Exactly from the Uber Docs.
I have some questions.
I have a phone on which Uber app is not installed. When the Ride Button is clicked , it nicely takes me to the webview and I can login and request for cab all seamlessly (ofcourse! sandbox). Things are fine till now. But I have another phone on which I installed the app (passing apk via email) on which I already have Uber app installed (and signed in). When I click on the Ride Button then it shows.
What's the reason for this?
What's the difference between implicit grant and oauth2. Is oauth2 preferable or it gives more functionality? or is it the same?
If oauth2 is preferable then Please! shed some information on 'redirect url'. Any samples will help me good!
My use case is simple: I purely want to help the user book a ride on his behalf!
EDIT:
I have the following further questions
When I use RideRequestWidget in the sandbox environment , it does NOT respect it. It simply deep links to my uber app (if installed) and I can actually book cabs.
I am logged into my Uber account (in the uber app) installed on my phone with the same credentials registered for my developer account. So According to the docs when I click on the riderequestwidget then it should deeplink and show me the view so I can book the cabs. But it shows the error mentioned (in the screen above)
If I sign out and then click on the widget so it deep links to the installed Uber app and I can practically enter 'ANY' ID (which is not registered to my developer's account) and it 'Logs me in'.
If the Uber App is installed, the Ride Request Widget will attempt to use Single Sign On to authorize the user. The authentication error could be any number of errors and you can check which by using onActivityResult and checking the intent extras for “authentication_error”. Most likely the error is you haven’t registered your application’s signature on the authorizations page of developer.uber.com. Check your logs for the application signature in an error, or generate it on your own via the instructions in the Login section of the Rides Android SDK README.
Implicit Grant is a flow type for OAuth2. A redirect URL may be used by your backend to get an access token with different flows. For the purposes of Implicit Grant, as long as the redirect URL you have registered on the authorizations page matches what you have in the SDK it should work (you could even have).
Related
I am developing an application in Flutter, which retrieves podometric data through Apple Health and Google Fit.
Apple Health is correctly configured.
Google Fit does not work.
The application asks for access to the data, it opens the pop up select an account then nothing happens, and the value returned corresponding to the access is false.
I am using the : health: ^3.0.3
I am requesting access like this:
DateTime endDate = DateTime.now();
DateTime startDate =
widget.user.lastTimeRecoverHealthData.add(Duration(seconds: 1));
HealthFactory health = HealthFactory();
List<HealthDataType> types = [
HealthDataType.STEPS,
HealthDataType.DISTANCE_WALKING_RUNNING,
];
List<HealthDataPoint> healthData;
health.requestAuthorization(types).then((value) {
print("health.requestAuthorization: THEN");
print("then return ${value}");
if (value) {
[...]
}
})
I can't find where I miss a step in the Google fit and Android process.
Any help is welcome.
You have to make sure the package name you registered to your project on Google Cloud Platform is matched with the package name from the app you are develop.
Check the OAuth 2.0 Client IDs from Credentials on your Google Cloud Console.
I ran into same problem you described and my mistake was the name from the Credentials is was not match with my app's package name.
FINALLY GOT THIS ISSUE SOLVED!!
So the problem doesn't lie in the version I am using 3.4.0 but still got the problem solved
Authorization not granted. And stuck in loading screen
Stuck in authorization request screen
When you create your OAuth 2.0 consent screen try to add at least 2 email addresses to the TEST USER section and make sure to login from that emails.
[Add 2 email addresses in Test User]2
After that make sure to verify your application from Google, it will work until you test your app once you release the application, it will not work
Verify Your Application from Google
Final Result
4
I am using the uberButton paradigm with callbacks. The first time I did this, the uber login screen appeared in the browser as expected, I logged in, and got the token. That token was missing the scopes = requests. Now I added the scope = requests (below). However...
Now when I press the uber button the browser pops but the browser gives an invalid URL. So, I cannot login again and re-authenticate / get new token.
whiteButton = (LoginButton) findViewById(R.id.uber_button_white);
whiteButton.setCallback(new SampleLoginCallback())
.setSessionConfiguration(configuration);
I have connectivity. Here is the URL the browser goes to:
market://details?hl=en&id=com.ubercab&referrer=mat_click_id%3D85a3402dced2004e2c2430188188049d-20180108-7336%26utm_campaign%3Dpartnership%26utm_content%3DInternal%26utm_medium%3DInternal%26utm_source%3DUber%2BAPI%26utm_term%3DInternal
QUESTION: How do I get the proper Uber Login page to show up once I press the button above?
configuration = new SessionConfiguration.Builder()
.setClientId(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.setScopes(Arrays.asList(Scope.PROFILE, Scope.RIDE_WIDGETS, Scope.REQUEST))
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.build();
If you have requested privileged scope when getting your configuration - the default behavior is to activate Single Sign On, so if there is no Uber application available on your phone - it will try to redirect you to the Play Store. The response you getting is valid in this case:
market://details?hl=en&id=com.ubercab&...
but this is not working on emulator. You can try to run your sample on your Android phone - and you will be redirected to the Play Store to install Uber app.
I have folowing scenario.
My client (local tv publisher) publishes some article and embeds tweet in it. ID of embeded tweet is sent through api to android application.
On android side i have integrated Fabric/TwitterKit and by following steps on twitter developers page i managed to show tweet in my android app on (i admit) easy way (Show tweet exp).
Now i have published application to Alpha and noticed one "little" problem :-). TwitterKit was using my local twitter account to authenticate and to show tweets. If you dont have Twitter application installed or signed out of it, my show tweet functionality wont work..
This is TwitterLogin explanation for obtaining TwitterKit auth token:
"When attempting to obtain an authentication token, the Kit will use the locally installed Twitter app to offer a single sign-on experience. If the Kit is unable to access the authentication token through the Twitter app, it falls back to using a web view to finish the OAuth process.
The simplest way to authenticate a user is using TwitterLoginButton, inside your layout..."
What i want is to simply show content of tweet by given tweetID. No sending tweets, or any other action with it. Just show data from given url. Is it possible without authentication, or what should i do now, so that current implementation works without user authentication (or with some non-single-signon-inside-app authentication)
Thank you.
UPDATE 1:
I have created MyApp extends Application class, and placed code below inside onCreate method. In application tag inside AndroidManifest file, added line:
AndroidManifest.xml
android:name=".MyApp"
onCreate:
TwitterAuthConfig authConfig =
new TwitterAuthConfig(DeveloperKey.TWITTER_CONSUMER_KEY, DeveloperKey.TWITTER_CONSUMER_SECRET_KEY);
Fabric.with(this, new TwitterCore(authConfig),
new TweetUi());
It works so far, but i am not sure if this implementations is valid.
DeveloperKey.TWITTER_CONSUMER_KEY and DeveloperKey.TWITTER_CONSUMER_SECRET_KEY are static values obtained from application created at apps.twitter.com.
You need to use Application Only authentication.
That will generate a set of keys which can be used by the application. It won't be able to post messages to Twitter (because no user is associated with it) but you will be able to read Tweets.
If you build the keys into the app, your user won't have to sign in.
All the documentation is at https://dev.twitter.com/oauth/application-only
First of all I'm sure that my fb app id is valid because users can log in my Android app using facebook credentials until some days ago (I think it's before Feb break change).
Recently new users cannot log in my Android app using facebook any more because facebook keep saying that my fb app invalid (Error is: Invalid application fb-app-id) BUT old users who already authorized my Android app for accessing their info can still log in using facebook. (Old users can still login to my app using facebook credentials but new users cannot)
Does anyone know why this happen to my facebook app and how to fix it?
Edit: When access to https://graph.facebook.com/facebook-app-id I get this error
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
Thanks you.
If you're sure the app is not in sandbox mode (which was gema.megantara's answer), and hasn't been deleted for policy reasons by Facebook the only explanation I can think of is that you've restricted the app demographically (i.e by country or age)
If that's the case the API won't return the app's details unless you make the API call using a user access token for a user who meets whatever restrictions you've applied, and users who don't meet the requirements won't be able to use the app.
If that's what you've done, you can remove the restrictions via the API (via the restrictions field of the Application object or in the ''Advanced'' tab in the app settings in the App Dashboard
If using the frontend interface to change the settings, it's the ''App Restrictions'' field you want to edit, screenshot attached
Basically the same solution as the accepted answer, just updated for the latest FB developer site has been updated so you need do this:
Apps->Your App
Status+Review
Do you want to make this app and all its live features available to the general public? -> Yes
Usually if you get error like that when visit https://graph.facebook.com/523132271032907 is because the sandbox mode is on. Have you try to reset the secret key ?
I think, this is because FB does not check whether application id is valid when the user has already logged in. It likely assumes that if the check passed, the id is valid. Apparently, locking out the users after making the app id invalid has never been a design goal.
try replacing:
<string name="facebook_app_id">CHANGE-ME</string>
with:
<string name="facebook_application_id">CHANGE-ME</string>
I'm in a situation where I need to request access tokens for two scopes (from my android application), https://www.googleapis.com/auth/userinfo.email and https://www.googleapis.com/auth/userinfo.userinfo
I would like to get both permissions on a single call to getAuthToken, but can't figure out the string to pass in the authTokenType parameter. I tried several reasonable combinations with no positive results :(
Has anyone solved this issue? Is it possible?
I was having the same issue. Shah is almost right, but his scope string is wrong. It should be
"oauth2:<scope_url> <scope_url>"
not
"oauth2:<scope_url> oauth2:<scope_url>"
If you need multiple OAuth 2.0 scopes, use a space-separated list.
oauth2:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.userinfo
You asked for sample code, so have a look at the Google Docs Upload Sample application, and in this application have look at the authentication flow done in this sample Android screen (ignore that it's about Google Docs, it still authorizes first). You can get the whole application and run it in an emulator with Google APIs present or run it on your phone. The authorization workflow starts with the buttonAuthorize click, Authorize() and you are specifically interested in this method:
private void gotAccount(Account account)
{
Bundle options = new Bundle();
accountManager.getAuthToken(
account, // Account retrieved using getAccountsByType()
"oauth2:https://www.googleapis.com/auth/userinfo.email oauth2:https://www.googleapis.com/auth/userinfo.userinfo", // Auth scope
//"writely", // Auth scope, doesn't work :(
options, // Authenticator-specific options
this, // Your activity
new OnTokenAcquired(), // Callback called when a token is successfully acquired
null); // Callback called if an error occurs
}
The user gets this access request screen:
Note that this is using the 'local' OAuth2 mechanism, not opening a web browser, but using the authentication provided when you first activated the Android phone.
Also note that the user sees the full URL of the scope instead of a friendly name, I haven't found a way around this and if you do find out it would be great if you could share the answer.