How to convert '\x1F�\b\x00\x00\x00\x00\x00\x02�U��j�0\x10E��\n' data gotten from google userinfo api to an object using nodejs - node.js

I am implementing google OAuth and i am recieving the access_token and and id_token quite alright.
After sending a request to google's userinfo endpoint as shown in this image enter image description here
I am recieving a success from goole with this data type on the response data
enter image description here
A few months ago when i implemented this on a seperat project i got back an object and not i am getting this, whatevery it is.
Can anyone point me where i can research or convert this to an object using javascript?
I am expecting an Object and i have tried using the global Buffer method available on Nodejs and i keep getting enter image description here

Related

Google Form API - unable to retrieve a respondent email

I am using Google Form API to create a sample project to create, update & get responses to a form.
I am using the following documentation for reference and understanding:
https://developers.google.com/forms/api/reference/rest/v1/forms.responses
It mentions that a single response body (using response ID) includes the respondent email, but each time I trigger the API, the respondent email is undefined and hence does not get returned in the response body.
What am I doing wrong?
Please note I am not using the Apps Script. I am using the API in a node.js project.
Thank you

api read filter for firebase. make a where call to the firebase in the document

enter image description here
enter image description here
I want to filter my database in firebase to call with read api. As the picture from firebase showing, my goal is to read all the meals in document with a specific filter created_by
I have made this script in the picture in below in node.js but it gives any result and I have an error in postman (500 internal servor). Please do you have any solution ?

Adding image from google drive into google slideshow with API

I'm trying to add an image that I've uploaded to Drive via the Drive API into a slide show I've created using the same API.
when Running the fairly standard:
response = (self
._slides_service
.presentations()
.batchUpdate(presentationId=slide_deck_id, body=body)
.execute()
)
I get:
googleapiclient.errors.HttpError: <HttpError 400 when requesting {url} returned "Invalid requests[0].createImage: The provided image is in an unsupported format.">
I'm generating the service in the same way as suggested in the documentation here: https://developers.google.com/slides/quickstart/python
My scope is:
https://www.googleapis.com/auth/presentations
If I run the command with a random png from the internet then it inserts the image fine. I've tried the url provided by webContentLink or WebViewLink values from the response from uploading the images. Neither are valid.
What URL will work to do this?
I'm aware there are other similar questions on stack overflow but all of them are not related to doing this in python or if they are, there solutions don't work.
EDIT:
body is:
{'requests': [{'createImage': {'url': url, 'elementProperties': {'pageObjectId': page_id}}}]}
had to generalise the url and page id because GDPR is a pain.

Display image in Background Url from MongoDB using NodeJS and Angular6

I have created an image uploader on my site and store the URL in my MongoDB. I used this guide to create my image uploader: https://appdividend.com/2018/05/25/angular-6-file-upload-tutorial/
However, when the file is stored in my MongoDB table it is a C:\\fakepath\\ url. When I try to display the url in a background-image url field via ngStyle I get the response:
Cannot read property 'image' of undefined
Here is my code for the .html page:
<div class="jumbotron" [ngStyle]="{ 'background-image': 'url(' + post.image + ')'}"></div>
The rest of the code follows suit to the guide for storing the image.
If there is a way to either modify the url before it is in the MongoDB or to eliminate the C:\\fakepath\\ and just append the end to the ./upload/ folder where the image is stored should work as well. I have tried also just using the {{post.image}} syntax and recieve the same result.
Please check the network call if you're really receiving the data
(post and url) from backend.
If you are then check the logic where you assign the backend response to variable post.
From the error, it seems that post has no value. Or you accessing it
the wrong way. Check if post is yourCtrl.post or something.

php library for flickr API

I am banging my head trying to use Flickr API...
My goal is to be able to upload images and create albums in my Flickr account from my website...
I tried the phpFlickr library but apparently it needs updates for getting authenticated tokens...It keeps giving me "Invalid auth token".
I did some reading on how to get tokens and using DPZFlickr managed to get oauth_token & oauth_verifier but failed to exchange that with an access token...It also failed in uploading any photo to my account using the included upload.php example (Giving me an "empty" error!).
After digging in DBZ flickr.php code, I managed to get this error when trying to upload to Flickr: "oauth_problem=signature_invalid&"
So I began to search how to create a valid signature to eventually get a valid access token...and concluded that it is quite some work to be done here if I am going to build everything from scratch.
So my question is: Are there any updated php libraries that I can use to successfully create albums and upload photos to my Flickr account? Or should I go ahead and try building one?
OK..I finally got it to work with the DPZ library.
For future reference anybody facing the same problem as I had:
I managed to create an album using DPZFlickr by changing the method in auth.php to flickr.photosets.create....which indicated that the library correctly generates an access token with write permission..
However, the upload example kept giving me the "Invalid signature" error....
I checked the code. Flickr.php correctly unsets the photo parameter before signing the request then adds it back and submits the request which is exactly as indicated in: www.flickr.com/services/api/upload.api.html
I found a discussion in https://www.flickr.com/groups/51035612836#N01/discuss/72157650261711318/ that cleared out that the error was not actually a signature problem, but rather the 'photo' parameter that is being sent is the problem. It's just that Flickr doesn't know what to do with the photo parameter so it sends the signature error.
So what' wrong with the photo parameter?
Flickr API requires that the image has to be sent in binary form...The DBZ library, Flickr.php script line 677, does the hard work for us using the cURL function in php (http://au.php.net/manual/en/function.curl-setopt.php).
It sends the $parameters (which includes the uploaded photo) to the post field of the http request which should do the upload in binary format for us.
However, a brilliant comment I found in CURL PHP send image
states that:
"CURLOPT_SAFE_UPLOAD defaulted to true in 5.6.0... so you will need to add curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); before setting CURLOPT_POSTFIELDS"
Checking the manual: http://au.php.net/manual/en/function.curl-setopt.php
it says:
"Added in PHP 5.5.0 with FALSE as the default value. PHP 5.6.0 changes the default value to TRUE."
So if your php version is 5.5.0 the library will work just fine whilst if using version PHP 5.6.0 you need to add a line before 677 in Flickr.php to change the CURLOPT_SAFE_UPLOAD to false (that's why the library works with some and others not).
To solve the issue...Just add this line before line 677 in Flickr.php:
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
That's it. (-:

Resources