I am trying to download the client_secret.json from google API. I am following the steps listed in https://developers.google.com/gmail/api/quickstart/ruby.
Use this wizard to create or select a project in the Google Developers Console and automatically enable the API.
In the sidebar on the left, select Consent screen. Select an EMAIL ADDRESS and enter a PRODUCT NAME if not already set and click the Save button.
In the sidebar on the left, select Credentials and click Create new Client ID.
Select the application type Installed application, the installed application type Other, and click the Create Client ID button.
Click the Download JSON button under your new client ID. Move this file to your working directory and rename it client_secret.json.
The client_secret.json file does download but it is empty. The title of the file looks like it must be the client_id ending in apps.googleusercontent.com however there is no data stored inside the file.
I assume this just pre-populates the json for you. If you check out API Client Library for Ruby (Alpha) - Client Secrets, you should be able to manually create it with the information on the same page that offers the "DOWNLOAD JSON" button.
Although this says it is for Ruby, I don't think the json format would be any different for other languages.
Here is a snippet of the example from the above Google Reference URL:
Here is an example client_secrets.json file for a web application:
{
"web": {
"client_id": "asdfjasdljfasdkjf",
"client_secret": "1912308409123890",
"redirect_uris": ["https://www.example.com/oauth2callback"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}
Here is an example client_secrets.json file for an installed application:
{
"installed": {
"client_id": "837647042410-75ifg...usercontent.com",
"client_secret":"asdlkfjaskd",
"redirect_uris": ["http://localhost", "urn:ietf:wg:oauth:2.0:oob"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}
The issue seems to be resolved now, as I can download them properly.
Related
I need to be able to launch my Electron app from the the browser (like sign in to Slack does). I know that I can add my protocol name to my Electron app using app.setAsDefaultProtocolClient(protocol[, path, args]) in Electron.
Then in electron-builder, I can use the package.json config build.mac with the extendInfo property to define "The extra entries for Info.plist". This however is the only instructions the docs give on how to use it.
What is the correct way add a protocol to the macOS info.plist using electron and electron-builder config build.mac.extendInfo and be able to use it as described?
(Posted a solution on behalf of the question author to move it to the answer space).
It now works with the following - I have added this to my Electron package.json:
"protocols": {
"name": "my-app",
"schemes": [
"my-app"
]
},
"mac": {
"target": "dmg",
"extendInfo": "my-app"
},
I have this in the electron.js:
app.setAsDefaultProtocolClient('my-app');
And this in my React browser client app code to launch the application from the browser:
document.location = 'my-app://open?url='
This question relates to how custom schemes are used to receive OAuth responses, as in my code sample which you can run locally, then use deep linking etc:
Code
Blog Post
Points of interest:
An interstitial web page returns control to the browser app - see this page
My package.json exposes the scheme for Electron deployment
This should give you something to compare against. Here is the key code:
INTERSTITIAL WEB PAGE INVOKING APP
window.addEventListener('DOMContentLoaded', function() {
var redirectUri = 'x-mycompany-desktopapp:/callback';
if (window.location.search) {
redirectUri += window.location.search;
}
document.getElementById('continueButton').onclick = function() {
window.location.href = redirectUri;
};
}
REGISTERING THE SCHEME
This gets picked up by Electron packager and included in platform specific binaries, resulting in OS specific registration:
"build": {
"protocols": {
"name": "finaldesktopapp",
"schemes": [
"x-mycompany-desktopapp"
]
}
},
RECEIVING NOTIFICATIONS
This enables the following code to work in the main side of the app, as specified in the main.ts file:
app.setAsDefaultProtocolClient(this._configuration.oauth.privateSchemeName);
Finally you register a callback that can parse the URL and take whatever is the appropriate action - completing a login in my case.
private _receiveNotificationInRunningInstance(privateSchemeUrl: string) {
}
The mechanics are a little tricky and the notification is received differently on macOS to Windows / Linux. See this source file and its comments which explain the details.
I am working on a Microsoft Teams chat bot using Microsoft Bot Framework. The bot sends an Adaptive Card containing some text and the following Action:
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "View in dashboard",
"url": "${url}"
}
]
},
The URL is of the following form (edited to remove identifying info):
https://internaldomain.net/dashboard/share/134590h9?overrides=[{"query":"//dataSources","key":"account","replacement":"accountName"},{"query":"//*[id='Cluster']","key":"value","replacement":"clusterId"},{"query":"//*[id='NodeId']","key":"value","replacement":"nodeId"},{"query":"//*[id='ContainerId']","key":"value","replacement":"containerId"}]&globalStartTime=1591552800000&globalEndTime=1592460000000&pinGlobalTimeRange=true
The URL is generated and passed into the url property using a JSON templating library, and I can print the URL in the console so I know it is set properly. Also, I can run the bot in the Emulator and open the link that way. However, when I run the bot in Teams and try to open the same exact link by clicking the action button, nothing happens. If I change what URL is passed in, e.g. using https://internaldomain.net/dashboard, the link works correctly.
One thought is that the generated URL is formatted improperly so Teams doesn't recognize it or open it. But I can paste it into a browser and it opens properly.
Another thought is that the URL length (almost 500 chars) exceeds some limit for Adaptive Cards, but I haven't been able to find any info about that in the documentation or online.
I would appreciate any other ideas about what might be causing this.
Thanks!
It looks like you're needing to encode the urls before embedding them - probably the {"query" etc. is conflicting with the final Json. It looks like you're using .Net, so you could call WebUtility.UrlEncode, on everything from "?" onwards (i.e. "?overrides...")
is there an option to make a policy or running an powershell command to add a specific app to ever Team.
My problem:
In my School ther are a lot of Teams (100 or so). Now we want to add an App (Sharepoint Document Libary)
to every to a specific channel whithin an team, so the students can use it. Is there an easy or do i have to add it manually to every Team?
You can use Graph APIs to automate this. Use Add a tab Graph APIs to configure new tab to your channel. Please take a look at example on how to Configure Document library tab.
POST https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/tabs
{
"displayName": "Document%20Library1",
"teamsApp#odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.files.sharepoint",
"configuration": {
"entityId": "",
"contentUrl": "https://microsoft.sharepoint.com/teams/WWWtest/Shared%20Documents",
"removeUrl": null,
"websiteUrl": null
}
}
The Google API does seem to permit to create comments and replies on any type of files (including binary files)
Also, I can publicly share a link and grant anonymous users having the link the permission to view and comment this file. This is the case of this picture with id=0BxMiPUSrDs2EMWVUQkR3cWsxRWs, yet, browsing this url as an anonymous user, I don't really know where are the comments and how to send a new comment.
Using this Drive API, I successfully created a comment:
POST https://www.googleapis.com/drive/v3/files/fileId/comments
Using this Drive API, I successfully listed the file comments:
GET https://www.googleapis.com/drive/v3/files/fileId/comments
Result is:
{
"comments": [
{
"kind": "drive#comment",
"id": "AAAAA-ZIom0",
"createdTime": "2017-03-28T17:21:18.008Z",
"modifiedTime": "2017-03-28T17:21:18.008Z",
"author": {
"kind": "drive#user",
"displayName": "Sébastien Lorber",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "Hello world",
"content": "Hello world",
"deleted": false,
"resolved": false,
"replies": []
}
]
}
So it seems this file does have a comment.
The problem is that, when using both the Drive web UI, and the Drive Android application, I am totally unable to access the content of this comment.
I can only see the comment appears as an entry inside the file activity log, so the Drive UI does know that there is a comment, but I am totally unable to find a way to read the comment content Hello world inside the official UIs.
So: am I missing something, or the Drive comment system is only to be considered as a SaaS backend for comments and the official UIs do not care of the comments we created (unless they are special kind of files, like Google Docs files).
Is there any Drive application out there that actually does show Drive comments for any kind of file?
Google Drive Comments:
View all comments:
Open a document, spreadsheet, or presentation.
In the top right, click Comments.
To close, click Comments again.
This issue is in how Google Drive works. Google drive only displays comments for the following types of files document, spreadsheet, or presentation.
While the API may allow you to add a comment Drive wont display it.
These comments should now be shown directly in the Drive UI: https://gsuiteupdates.googleblog.com/2018/02/comment-on-files-in-drive-preview-mode.html
If i go to https://developers.facebook.com/docs/plugins/like-button/ and enter https://www.ballantinesbarproject.fr/?name=epicerie and select box-count as layout.
the like-button shows a like count, as expected, since I liked the page. However, if I look in facebook api:
REST:
https://api.facebook.com/method/links.getStats?urls=https://ballantinesbarproject.fr/?name=epicerie&format=json
FQL:
https://graph.facebook.com/fql?q=select%20url,%20like_count%20from%20link_stat%20where%20url=%22https://ballantinesbarproject.fr/?name=charlatan%22
(though one user claims, he can se counts in the fql-api)
It says there is 0 likes. How come?
Following query is the proper FQL Query for retrieving like or comments count for a link
select url, like_count from link_stat where url="https://ballentines.herokuapp.com/?name=charlatan"
I have debugged the above Query with Graph Explorer
Reference : https://developers.facebook.com/tools/explorer/145634995501895/?fql=SELECT%20like_count%20FROM%20link_stat%20WHERE%20url%20%3D%20%27https%3A%2F%2Fballentines.herokuapp.com%2F%3Fname%3Dcharlatan%27
If you check on above link, you would get proper like_count (now 3). Screenshot below
If you check above Screenshot the application selected is "Graph API Explorer" which is the default App while debugging with Graph API explorer.
If you are logged in with your proper Developer Account. the application Dropdown would also have your Application.
So after switching to your Application, click "Get App Token" and then submit the Query.
Now the like_count would come 0 for the same query. See Below Screenshot.
Now click on "Get Access Token", this would ask you to Allow the App if you not already done so. After "Allow App" proper User Access Token would be loaded in "Access token" box and now again Submit your Query. Now the "like_count" would be 3 as expected.
So you would need proper User Access Token to retrieve proper information from "link_stat" FQL table and App access token wont work for it
Hope this helps.
I guess you should use the following FQL:
select url, like_count from link_stat where url="https://ballentines.herokuapp.com/?name=charlatan"
Gives me
{
"data": [
{
"url": "https://ballentines.herokuapp.com/?name=charlatan",
"like_count": 1
}
]
}
as result...
The Open Graph debugger shows that the og:type meta-data is missing. That could be related to the problem. Can you add it?
https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fwww.ballantinesbarproject.fr%2F%3Fname%3Depicerie