I have the problem with Telegram Web App and Google App Script.
I can browser the web (that build on google app script) on Telegram bot but can not receive value from initDataUnsafe from Telegram Bot return (I use Menu Button on Bot to browser the web app)
I have try to build the web app on Flask and my server, the web app bot working and return initDataUnsafe correctly.
Maybe Google App Scipt is not working with Telegram Web Bot, anyone have the same problem with me, and let me know the root cause. Thank you so much!
I flowing this document: https://prog.world/creation-of-telegram-web-apps-and.../
Here is my code:
<html>
<head>
<base target="_top">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<body>
<h1 id="console">Hello1</h1>
<button id="check_btn" type="button" class="btn btn-primary">Check</button>
</body>
<script>
var tg = window.Telegram.WebApp;
tg.expand();
document.getElementById("check_btn").addEventListener("click", doStuff);
function doStuff() {
console.log("Button is clicked!");
document.getElementById("console").innerHTML = tg.initDataUnsafe.user;
}
</script>
</html>```
Related
I'm using firebaseui in a web app and I get this error in the console logs:
Loading failed for the with source “https://cdn.firebase.com/libs/firebaseui/3.5.2/firebaseui.js”.
The auth UI itself, as expected, doesn't load. The domain cdn.firebase.com resolves to:
Name: f6.shared.global.fastly.net
Address: 151.101.154.202
It resolves to a different IP address from hosts from which the auth UI loads. Is there anything I could do to ensure that the firebase auth UI loads reliably regardless of where the host is located?
Thanks,
Abhishek
The Firebase UI Web library is hosted on both the cdn.firebase.com and gstatic.com CDNs.
Try using this instead:
<script src="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth.css" />
I'm using firebase functions. And there is a problem. I deployed my functions source to firebase yesterday. It was working source and serviced well util today. But right now! suddenly returns internal error and not logging it(Firebase doesn't show internal error in firebase logger i don't know why). I didn't edit my source and it was not difficult code.
This is my code.
exports.keyboard = functions.https.onRequest((request, response) => {
responseMessage = {"type" : "buttons", "buttons" : global.defineManager.MAIN_BUTTONS}
response.status(200).send(JSON.stringify(responseMessage))
});
And this is what i received.
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.
<p>Please try again in 30 seconds.
</h2>
<h2></h2>
</body>
</html>
I'm using firebase blaze price. What should i do? What am i wrong?
It is a problem on firebase itself, not yours. Currently they are reporting a service outage.
https://status.firebase.google.com/
There seems to be a bug with the LinkedIn JS SDK. You're able to reproduce with the code they supply in the "Getting Started" section of the docs.
<!DOCTYPE html>
<html>
<head>
<title>LinkedIn test</title>
<script>
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
IN.Event.on(IN, "auth", getProfileData);
}
// Handle the successful return from the API call
function onSuccess(data) {
console.log(data);
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
// Use the API call wrapper to request the member's basic profile data
function getProfileData() {
IN.API.Raw("/people/~").result(onSuccess).error(onError);
}
</script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: [API_KEY]
onLoad: onLinkedInLoad
</script>
</head>
<body>
<script type="in/Login"></script>
</body>
</html>
If you put this code on a non-https site and hit that URL on iOS Safari, clicking the "sign in with LinkedIn" button will initiate authorization, but the 'auth' callback will never fire. Instead, you'll get a CORS error in the console:
"Uncaught SecurityError: Blocked a frame with origin "https://platform.linkedin.com" from accessing a frame with origin ..."
All other environments seem to work fine (e.g. Chrome, FF, IE, Desktop Safari, Android browsers, etc.). I'm also able to reproduce the issue if I set the user agent to an iOS device in Chrome's dev tools, which makes me think the JS SDK is doing user-agent sniffing.
Is there a workaround? Is the LinkedIn dev team aware of this issue? Did I miss a Monday detail?
PS This is probably related: Sign in with Linkedin doesn't trigger callback on iOS Safari when using the JS API
According to LinkedIn's Getting Started with the JavaScript SDK page, the LinkedIn JavaScript SDK doesn't support iOS 5+.
Note: The JavaScript SDK is not compatible with iOS 5+.
#degrassesagan I think you need to do the following:
function onLinkedInLoad() {
IN.Event.on(IN,"auth",getProfileData);
IN.Event.on(IN,"success",onSuccess);
IN.Event.on(IN,"error",onError);
}
There is also a side issue, I have discovered, in relation to the LinkedIn JS SDK. I am using mobile Safari 10.3.3, and although the login business logic executes correctly, the URL flow does not.
After a successful login, the page goes to a LinkedIn 'Page Not Found' page, rather than closing the current browser tab, to reveal the owner's page underneath?
I am not sure whether this is connected to the original question or not, but I would be grateful, if anyone could shine a light on this problem.
I'm attempting to implement the GITKit in a Asp .NET Web Api 2 application.
I followed the instructions on the google developer kit. When I go to my sign in page, it redirects to accountchooser.com. So far, so good. I have a google account shown, so I select it. The page reloads, but it is completely blank. No call is received on my sign in successful url. The javascript console shows:
Uncaught Error: At least one sign in option should be specified! gitkit.js:250
Any ideas? What am I doing wrong? How does one debug the various calls to see where things are going haywire?
Thanks.
in your sign in html page where window.google.identitytoolkit.start() is called, you need to pass a configuration object to the start() method with signInOptions defined. Below is an example:
<script type="text/javascript" src="//www.gstatic.com/authtoolkit/js/gitkit.js"></script>
<link type="text/css" rel="stylesheet" href="//www.gstatic.com/authtoolkit/css/gitkit.css" />
<script type="text/javascript">
var config = {
apiKey: '...',
signInSuccessUrl: '/',
signInOptions: ["google", "password"]
};
window.google.identitytoolkit.start(
'#gitkitWidgetDiv', // accepts any CSS selector
config);
</script>
No matter how hard I try, and no matter the url format I'm giving in the Setting the SDK Domains section of the Linkedin Javascript SDK, I keep getting this error in my console:
Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.
My setup it's as simple as possible :
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:afyXZGKtvrVoXXXX
</script>
I've tried all the URL variations in the SDK Domains section:
having localhost with and without port ( http://localhost:9000 )
having a custom hostname with and without port ( http://dev.local:9000 )
having a real existing domain name ( heroku app ) (http://somename.herokuapp.com)
Nothing worked, keep getting the same error.
Any advice appreciated.
Thank you,
Try this:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:afyXZGKtvrVoXXXX
authorize: true
</script>