can anyone help me to clear the error occured in uber api - uber-api

after authorizing the app in python the auth_url is showing invalid scope after getting the url
auth_flow
=AuthorizationCodeGrant("Ws4Za7kSxIdQdpxcZnL2WC9L8NVl3UBT","all_trips delivery history history_lite places profile request request_receipt
ride_widgets","qccwQVFYdzSIFwD86DIYAJeBB-Wg8KBuXO0mWiNN","http://127.0.0.1/")
http://127.0.0.1/?error=invalid_scope&state=WD7kEksCoCsUap219zzge18MuoxV6bvS#_

You are not passing the scopes properly, your scope list looks like following after AuthorizationCodeGrant is executed:
scope=a+l+l++t+r+i+p+s+++d+e+l+i+v+e+r+y+++h+i+s+t+o+r+y+++h+i+s+t+o+r+y++l+i+t+e+++p+l+a+c+e+s+++p+r+o+f+i+l+e+++r+e+q+u+e+s+t+++r+e+q+u+e+s+t++r+e+c+e+i+p+t+++r+i+d+e++w+i+d+g+e+t+s&state=0kFxqT7cTka4pbkbdAObpSzrh8mF4pUR&redirect_uri=http%3A%2F%2F127.0.0.1%2F&response_type=code&client_id=Ws4Za7kSxIdQdpxcZnL2WC9L8NVl3UBT
So you will need to do something like this:
auth_flow = AuthorizationCodeGrant(
'XXX',
{'all_trips ', 'delivery', 'history', 'history_lite', 'places', 'profile', 'request', 'request_receipt', 'ride_widgets'},
'XXX',
'http://localhost'
)

Related

IBM Watson Speech-to-Text speech-javascript-sdk "HTTP Authentication failed; no valid credentials available"

I'm trying to set up IBM Watson Speech-to-Text to run in my Angular frontend. I'm using German Attanasio's speech-javascript-sdk library. I want the transcript text to go to the console so I'm using the microphone-streaming-object-to-console.html example. Here's my code:
const options = {
token: $scope.token,
model: 'en-US_BroadbandModel',
word_confidence: true,
object_mode: true
};
var stream = WatsonSpeech.SpeechToText.recognizeMicrophone(options);
The error I'm getting is
watson-speech.js:10482 WebSocket connection to 'wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_BroadbandModel&watson-token=[object%20Object]' failed: HTTP Authentication failed; no valid credentials available
My guess is that my token isn't in the right format. The IAM bearer token is provided as a JSON object:
{
access_token: "eyJraWQiOiIyMDIwMDIyNTE4MjgiLCJhbGciOiJSUzI1NiJ9.e…",
expiration: 1585264266,
expires_in: 3600,
refresh_token: "OKA5toCaoVmYsPbwpjARE1971xspAe7Xg5nOm9pRrLKjKgaubr…",
scope: "ibm openid",
}
I tried providing the bare naked access_token, and I tried providing the JSON object. Both resulted in the same error message. Which format is correct?
Did I set up the options object correctly? Is it object_mode orobjectMode?
I don't understand what Object.assign(token, means in the example code.
I had the same problem and I found the solution working perfectly:
In 'options' constant you need to change the field 'token' by 'accessToken' and It should be works.
NOTE:
The field 'model' in 'options' has a default value, but if you want to change it you have to set value to 'model' and 'laguage',
const params = {
accessToken: 'token'
format: true,
extractResults: true,
objectMode: true,
model:'es-MX_BroadbandModel',
laguage: 'es-MX'
};

conv.askToDeepLink is not a function

The old way of invoke the askToDeepLink are no more working in DialogFlow even in V1.
app.askToDeepLink('Great! Looks like we can do that in the Android app.', 'tool for Android',
'sample://scheduleMeeting', 'com.sample', 'handle this for you');
Anybody know the way to invoke askToDeepLink in V2?
If you are trying to connect one of your Android apps with your Assistant app, you should try this.
app.intent('ask_to_deep_link_detail', (conv) => {
const options = {
destination: 'Google',
url: 'example://gizmos',
package: 'com.example.gizmos',
reason: 'handle this for you',
};
conv.ask('Great! looks like maybe we can do that in the app.');
conv.ask(new DeepLink(options));
});
Getting the results of the helper
If the user accepts the link, the dialog with your app will end and you will not receive further requests. If they reject the link, you will receive another request with the intent actions.intent.LINK and a status argument:
app.intent('ask_to_deep_link_confirmation', (conv, params, response) => {
conv.ask('Okay maybe we can take care of that another time.');
});
I hope this helps.

Client-side validation with Facebook Registration XFBML

I'm using XFBML embedded in a HTML5 document. I've set up client-side validation following the instructions provided in the "Registration Advanced Uses" doc on Facebook's site, but it only shows errors on blur, and doesn't validate when I click the "Register" button (so if I fill out a field wrong and click outside on another element, it displays the error, but then I can click on the Register button and it registers me anyway).
I've traced it in the JS debugger, and by adding alert/log statements, and my validate_registration function only gets called onblur, and never when I click the Register button.
Anyone seen this behavior and know what I'm missing here? The live example Facebook has on the "Registration Advanced Uses" works perfectly, so I know I've got a mistake somewhere.
My XFBML tag is this:
<div class="fb-registration"
onvalidate="validate_registration"
fields="[
{'name': 'name'},
{'name': 'first_name'},
{'name': 'gender'},
{'name': 'email'},
{'name': 'user_type', 'description': 'Are you a?', 'type': 'select',
'options': {
'parent': 'Parent/Guardian looking for childcare',
'sitter': 'Babysitter/Nanny looking for sitting jobs'
}
},
{'name': 'zip_code', 'description': 'Zip code', 'type': 'text'},
{'name': 'over_eighteen', 'description': 'I am at least 18 years old', 'type': 'checkbox' }
]"
fb_only="true"
redirect-uri="<%= parse_fb_connect_signed_request_users_url %>"
width="530">
</div>
and my validation function is this:
function validate_registration (custom_fields) {
var errors = {},
regexZipCode = /^\d\d\d\d\d$/;
console.log("in validate_registration");
if (custom_fields.user_type !== 'parent' && custom_fields.user_type !== 'sitter') {
errors.user_type = "Select either Parent or Sitter";
}
if ( ! regexZipCode.test(custom_fields.zip_code) ) {
errors.zip_code = 'Enter your 5-digit U.S. zip code';
}
if ( ! custom_fields.over_eighteen ) {
errors.over_eighteen = 'You must be at least 18 years old to use this site!';
}
return errors;
}
So, never mind this.
I was getting the message "You've just registered for X using your Facebook account.
If you didn't mean to do this, you can undo this below." and thought that it meant I had registered. But if I click "Continue" at that point, it shows me all the validation errors, so it does work correctly - it just doesn't validate until after the final step.

action links text in facebook post to wall dialog using javascript not working

I trying to bulid a facebook application using javascript.In my application, the user gets the result and a dialog after a time delay popup. Everthing is working well except one here's my code for the 'post to wall dialog'
<script>
var publish = {
method: 'stream.publish',
display: 'popup', // force popup mode
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
actions: [{ name: 'action_links text!', link: 'http://www.example.com' }],
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://www.example.com/'
}
};
FB.ui(publish, Log.info.bind('stream.publish callback'));
</script>
The line containing actions not working for me.Can anyone just inform what is the solution for this...
The property should be called action_links not actions and only have text and href values. Use something like:
action_links: [{ text: 'action link test', href: 'http://example.com'}]
Note that the action must be defined through the fb web interface for the app!

How to use the user object in Facebook dialog using Facebook javascript SDK?

I want have feed dialog in which i also want to use his First name or user object.I'm using FB.Ui method.
<script>
var publish = {
method: 'stream.publish',
display: 'popup', // force popup mode
attachment: {
name: 'I visted this Appp',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://fbrell.com/'
}
};
FB.ui(publish, Log.info.bind('stream.publish callback'));
</script>
As you can see in caption it is ' i visited this app'.I want to change it to the Facebook user's first name..i.e 'first_name visted this app'..Anyone can help me out
To get info about the user, you would first need to have them authenticate with your application (no extended permissions would be needed as name is considered "basic" information). Then you could then call a FQL query with the javascript api to get their name and then use that to populate the message.
Authenticate user:
<fb:login-button autologoutlink="true"></fb:login-button>
Get users name:
FB.api(
{
method: 'fql.query',
query: 'SELECT name FROM user WHERE uid='+FB.getSession().uid
},
function(response) {
alert(response[0].name);
}
);