QR code is not encoding the response from Google oAuth's ID parameter properly - encoding

I'm trying to create QR code server side from a Google oAuth data response - specifically the oAuth's ID parameter.
It is a string of value: 112988110291746805492
When I try to copy and past this into any online QR code generator (or to create it on my back end) my QR reader won't scan it - nothing happens.
Oddly if I append this to an url e.g. www.bbc.co.uk/112988110291746805492
then it works and the scanner picks it up.
The QR reader is working properly as I tried it with www.bbc.co.uk encoded and that was fine too.
I've attached the images of the QR codes for reference:
Can anyone help?

Related

Google Signin for Unity (Windows standalone build) - invalidGoogleToken when used with Playfab

Hopefully someone can point me in the right direction here, I'm attempting to log into Playfab using a google auth code retrieved from an async call in Unity, the flow is as follows:
Click my login to google button in Unity.
Unity begins to listen for the response and opens a google login browser session.
User clicks email/signs into email they want.
This response is returned to Unity with an auth code.
I have then attempted to use the returned google auth code with playfabs LoginWithGoogleAccount method":
PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
{
TitleId = PlayFabSettings.TitleId,
ServerAuthCode = returnedWindowsGoogleAuthCode,
CreateAccount = true,
}, OnPlayfabGooglePlayAuthComplete, OnPlayfabGooglePlayAuthFailed);
This then fails with a returned response from playfab with "invalidGoogleToken".
From what I've read from what I've come across on google is that this token is possibly in a "used" state by the time I am calling LoginWithGoogleAccount and I possibly need a refreshed token? but I am not too familiar with the Google API so I could be completely off the mark there? But if this is the case what should I do here? How do I re-request a valid token without going back to the browser to do the same thing again?
To give you an idea of pretty much the exact code I'm looking at but I've altered slightly to get it to work in Unity I am following the Google Sample OAuthDesktopApp code:
OAuthDesktopApp Sample Code
I am calling the method "button_Click", this runs and makes the request, Unity then begins listening for the google response at line 72 and the auth code is then output to logs at line 129.
This auth code output at line 129 is what I have then been passing back in to LoginWithGoogleAccount which then results in the failed "invalidGoogleToken", this does also then run a request for user information which does correctly return the name/email of the user you signed in with etc.
Just to add to my previous comments, if I remove the call to performCodeExchange line 132 (I read somewhere that at that point I am swapping the auth code for a token and thus the auth code will no longer work? I'm guessing here) and then if I call PlayFabClientAPI.LoginWithGoogleAccount with the auth code I am presented with:
PlayFabError error:
error.GetHashCode(): 2051826304
error.Error: InvalidGoogleToken
error.ErrorMessage: invalid_grant details: Missing code verifier.
error.ErrorDetails: null
Hopefully this may help someone guide me.
First thanks to those that replied to this, So I've managed to solve this after a comment from a Playfab mod, There appears to be no official way from Google to login using a standlone Unity build nor an official way to then login to Playfab using the same build method.
The solution I've used uses a modified Unity version of one of the Google samples from OAuth 2.0 for Mobile & Desktop Apps .
This will allow you to get the oauth code within Unity then you can pass this oauth code to Playfab for login, BUT Playfab has since deprecated the way to do this (which is silly if its the only solution) so you need to modifiy Playfabs SDK to include the accesstoken then you can use this to finally login.

Google Home not getting a valid assistant response when executing actions for bulbs

I have integrated google assistant into my own app. When executing an action for a LIGHT device type, such as turning it on/off, I get an assistant response like "OK, Sorry, I can't reach the Bulb right now. Please try again" but the execution happens anyway. Following is a sample response which will send in response to an execute intent request.
{"payload":{"commands":[{"ids":[12549],"status":"SUCCESS","states":{"online":true,"on":true}}]},"requestId":"15838577278862147328"}
What am I doing wrong here? this works perfectly for other device types (OUTLET, SWITCH).
Also I can use the home app ui for bulb to control it manually and it works perfectly.
The bulb I'm using is a TuyaSmart rgb light bulb.
Looking at the response, it appears that the identifier 12549 is a number and not a string. The platform expects a device ID to be a string. By putting it in quotes it will work.

Google youtube api sample: Where to paste authentication code?

Trying to run the sample code here: https://github.com/google/google-api-nodejs-client/blob/master/samples/youtube/playlist.js
It opens the browser after node playlist, and after allowing all the permissions, displays the screen below.
Pasting the code back to the console does nothing.
Not sure how to proceed from there.
Well in the comments they wrote:
// Open an http server to accept the oauth callback. In this
// simple example, the only request to our webserver is to
// /oauth2callback?code=<code>
Opened a new window and paste the code in http://localhost:3000/oauth2callback?code=<code>. The instruction could be improved imo.

App42 API Unity SDK: getTinyUrl() return null when using File Upload Service

I'm using the App42 Unity SDK for uploading binary files; it used to work just fine, but now I've started to get "null" when retrieving the tiny url by calling fileList[i].GetTinyUrl(); (just as a documentation shows). The file is uploaded succesfully and only the tiny URL seems to be broken. The regular URL is too long for using in App42 private messages, so it is a blocking issue.
Any ideas?
Sometimes when tiny url service is not available, it might return null, however you can convert it by your own by calling tiny url service from your app.See this tutorial for the same http://www.codeforest.net/how-to-shorten-url-using-tinyurl-service

GWT:How to generate pdf save/open window?

I am using GWT2.4 version in my application.In this I application I have created Form using GWT control (like textbox,textaera).
I have also created preview of form.In that preview I have button of pdf generation.
Now I want to create behavior to deal with pdf link same as browsers(Mozilla/chrome).
For example in Mozilla on click of pdf link it asks for either save or open in a pop up window.
While debugging I found a jar name iText which can be used to create pdf, I want to implement browsers behavior in this also.
Please help me out.
Thanks in advance.
Read file contents into byte array.
Then do request for servlet or service, for eg. this way:
Window.Location.replace("rest/downloadPdf");
That Service should return Response with the right content type:
#Path("downloadPdf")
#GET
#Produces({"application/pdf"})
#Consumes(MediaType.TEXT_PLAIN)
public Response downloadPdf() throws Exception {
byte[] bytes = getYourPDFContents();
return Response
.ok(bytes, MediaType.APPLICATION_OCTET_STREAM)
.header("Content-Disposition", "attachment; filename=\"yourFile.pdf\"")
.build();
}
Browser will then show save as dialog.
That's example of Service, you must include Jersey library into your project to be able to use method like I've wrote above .