Google API - Cannot connect to account - javascript

Regards,
today I started a project where I want to get all data information of Google Analytics via API and through Javascript (https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-js?hl=en&authuser=1)
I already did all configuration (Client and View ID, OAuth consent) but when I test on my localhost it says "Error 401: invalid client"
(https://i.stack.imgur.com/Bdsr3.png)
Has this happened to anyone else?
Thanks in advance
Restarted localhost, changed parameters

Related

Microsoft Graph api - write files to my oneDrive

I am writing a simple web app (Javascript) that includes a form, once the form has been submitted I want to save the data on my oneDrive as a new file. That's all! But for some reason, I cannot accomplish this simple task.
So I want to use oneDrive as my database. but all I can find on the Microsoft Graph API are require a login popup which does not make sense here for me in this case cause the user have nothing to do with that. just want the details will be submitted into my personal oneDrive.
I am using client_credentials flow to generate access token but I keep getting errors like 'Unable to retrieve tenant service info.' or 'Current authenticated context is not valid for this request'
when I try to access the drive API.
I gave all the possible permissions to this app, I am using my personal free Microsoft account
so What am I missing here?
Another issue that I will be happy to know more about is that in my Azure app registration after I register this app and I go to the owner's tab I see this message - 'This app does not belong to any directory, so owners can’t be added to it.' is that might be the problem? how and do I even need to assign this app to a certain directory to use the API for my personal drive?
Also when I am vising the Users section on my Azure portal I see this message - 'You don't have access to this data.'
How is that possible if I do not belong to any organization and I created this azure account??
Thank you in advance, any information here will be helpful cause I am kinda lost.
I am using client_credentials flow to generate access token but I keep
getting errors like 'Unable to retrieve tenant service info.' or
'Current authenticated context is not valid for this request' when I
try to access the drive API.
For this you could use the Code Flow authentication
In this, you will not be needing any tenant information - just the client credentials and access token to access the OneDrive API
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth?view=odsp-graph-online#code-flow
This app does not belong to any directory, so owners can’t be added to
it
If the app had been registered in the converged app portal - you are likely to encounter this. You can you portal access this link and login with your personal account\live account.

How to authenticate firebase user in google cloud shell

I am sending my data from firestore to algolia. Before sending that I have to set that data from firestore to google cloud platform. For that I ran following commands on google cloud shell terminal:
firebase login
Then it gave me this messsage:
Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
Then it asked for Allow Firebase to collect CLI usage and error reporting information?. I replied yes. Then it gave me a link to authenticate the account. After clicking on that link, it gave an error message.
This is the error message which I recieved
How to resolve this error? I tried many tutorials but could not find any solution. i tried this link.
https://developers.google.com/identity/protocols/oauth2/web-server#handlingtheresponse
Well, This is happened on my side as well.
When the link has been displayed in console part of it wasn't detected by the terminal application. As the result it opened in web browser just as a part of the link. If analyze whole link you will see that near the end of the link there is something like response_type=. If this part is missing this error massage is shown.
I hope it will help!

How do I get "storageBucket" in Firebase to generate?

Firebase keeps giving me empty "" instead of generating a URL for "storageBucket" when I try to get the code to paste into my HTML for login through Google. I am assuming this is the reason I am getting the error: This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.(anonymous function) # iframe.js:84
I am using browser sync to user localhost which is supposed to be an authorized domain. I have the firebase cdn in my header of my HTML and everything that was generated for my firebase app (except for the storageBucket). I tried importing my app to the new Firebase, just typing in my app name in a similar storage bucket URL ("eventSpot.appspot.com") and I tried just creating a new app in Firebase. None of these worked. Is there something I am missing?
Thanks in advance for your help! :)
The storage tab can take some time just after project creation - but if you've left it a little while and you're still getting the error, it may be some APIs have not been enabled.
Can you go to https://console.developers.google.com/project/_/apis/enabled
Check for:
App Engine Admin API
Google Cloud Storage
Google Cloud Storage JSON API
If any aren't enabled, enable them. After that, try the storage console again.

Tokbox Opentok error - OT.Publisher.onStreamAvailableError Permission Denied on Google Chrome

We are using https://static.opentok.com/v2/js/opentok.min.js
Facing intermittent issues while using Google Chrome v47.0.2
As soon as the session is connected, without showing the permission dialog, the browser directly throws an access denied message (cannot access microphone or camera) with this error in the console "OT.Publisher.onStreamAvailableError Permission Denied" . This error has started occurring recently - mid-December.
We tried exploring the issue on various forums including this one. We could only come up with this post - https://support.tokbox.com/hc/en-us/community/posts/205065196-displaying-error-opentok-min-js-64-1500-Session-publish-OT-Publisher-Access-Denied-Permission-Denied-End-user-denied-permission-to-hardware-devices-?input_string=OT.Publisher.onStreamAvailableError%20Permission%20Denied%20on%20Chrome
But, it's irrelevant, since we are using https for all our application requests.
Please help as we are stuck on the production environment with this bug.
Are you using moderator or publisher as role when creating your token? use session.generateToken() to generate a token every time a new user gets online, example on nodejs https://tokbox.com/developer/sdks/node/
please see error # 1500 here https://tokbox.com/developer/sdks/js/reference/Error.html for more information

External Javascript client Authorization for Google Drive upload

I'm developing client application based on Javascript that won't be a Google App. I can create files on Drive but have a problem with a authorization when trying to upload the content.
A comment in:
Authorization of Google Drive using JavaScript
seems to say that the client must be a google App to write to Drive but until I saw this comment I thought this was possible reinforced by my ability to create empty files. Please will somebody clarify this?
I'm using code similar to response 3 of the post however I only get the login screen nothing asks for Google Drive permissions.
My code uses the 2 part "media" upload method described in How do I add/create/insert files to Google Drive through the API?
As I say the file create works but the upload fails:
PUT https://www.googleapis.com/upload/drive/v1/files/0Bxbwly1hLFXnVmQ3Snh3ZXVOYVE?uploadType=media&alt=json&key= 401 (Unauthorized) rs=AItRSTNkdxHWOPN1C6XNGC9ea3U4KWDICw:128
:response>{"error" {"message" "Invalid Credentials", "errors" [{"domain" "global", "reason" "authError", "message" "Invalid Credentials", "locationType" "header", "location" "Authorization"}], "code" 401}}
I'm not using Javascript direct rather Clojurescript so it is possible there is a problem with my upload call. The lack of anything asking for Google drive permissions would seem to indicate a real authorization problem but then I would have expected not to get an access_token when requesting "https://www.googleapis.com/auth/drive". Thanks
Update....
I've finally solved this: If I request "https://www.googleapis.com/auth/drive.file" rather than the greater privileges "https://www.googleapis.com/auth/drive" then the authentication requests access to Drive and the file content is uploaded.
I've finally solved this: If I request "https://www.googleapis.com/auth/drive.file" rather than the greater privileges https://www.googleapis.com/auth/drive then the authentication requests access to Drive and the file content is uploaded.

Categories

Resources