firebase v3 - google auth "internal-error" - javascript

I try to migrate my google-auth-only project from firebase 2.x to 3.0 using the web-sdk example from:
https://github.com/firebase/quickstart-js/blob/master/auth/google-redirect.html
After setting up the initialisation-code with apiKey (via Google-Developer-Console - used the server-option) and all the other needed options, i use the "login with google"-button.
After this, an redirect-screen appears, then redirecting back to starting page and getting an "auth/internal-error".
Any suggestions?

I would recommend importing your project in the Firebase Console rather than configuring keys manually if possible, but appreciate there are some cases where that isn't ideal.
For the API key, try switching to the "Browser" type key rather than the "Server" one for anything running in the browser, and make sure it is approved for the domain you are using.
Google Sign In will need a client ID as well. The easiest way to implement is to use the signInWithPopUp method, but there are instructions for manually configuring the Google Sign In lib too.
If you do need to create a client ID, you can see the full instructions in the Google Sign In documentation.

Related

AWS Session/Credentials/Auth

I'm following an AWS workshop for SaaS Serverless, however they wrote it with python code and i'm not very good at python so i'm trying to rewrite everything in javascript. It was doing ok until i get to the problem in title.
They use this function to get authentication so i can register my tenant.
import boto3
from aws_requests_auth.aws_auth import AWSRequestsAuth
def get_auth(host, region):
session = boto3.Session()
credentials = session.get_credentials()
auth = AWSRequestsAuth(aws_access_key=credentials.access_key,
aws_secret_access_key=credentials.secret_key,
aws_token=credentials.token,
aws_host=host,
aws_region=region,
aws_service='execute-api')
return auth
The problem is I didn't find a way of getting credentials unless i hardcode it.
My question is: How can i make this function work the same way in javascript?
EDIT:
This is the workshop i'm following:
https://catalog.us-east-1.prod.workshops.aws/workshops/b0c6ad36-0a4b-45d8-856b-8a64f0ac76bb/en-US
This is the github repo (I'm currently on Lab 2):
https://github.com/aws-samples/aws-serverless-saas-workshop
This is the source of the function i talked about:
https://github.com/aws-samples/aws-serverless-saas-workshop/blob/main/Lab2/server/layers/utils.py
So I did a bit of digging through the source code and found the place where they declare the AWSRequestsAuth class here. TL;DR - it's a class that helps connect to AWS services via Amazon's signature version 4 signing process.
For your problem of getting credentials without hardcoding, I found this guide for Node.js on setting credentials:
You can supply your credentials in order of recommendation:
Loaded from AWS Identity and Access Management (IAM) roles for Amazon EC2
Loaded from the shared credentials file (~/.aws/credentials)
Loaded from environment variables
Loaded from a JSON file on disk
Other credential-provider classes provided by the JavaScript SDK
It also has further reading to help out with strategies for loading credentials. I know this doesn't directly answer the question, but I hope this helps!
To use any of the AWS SDKs, always refer to the corresponding Developer Guide. YOu can find a list of supported DEV Guides here:
https://docs.aws.amazon.com/code-library/latest/ug/what-is-code-library.html
See:
As you are interested in the AWS SDK for JavaScript, look at the DEV Guide for this SDK. You can find detailed information abut creds in this topic :
Setting credentials

How to retrieve work items from Azure DevOps extension?

I successfully followed Microsoft's tutorial to create an extension.
I'm trying to get all the work-items of certain sprint, but to be honest, I'm lost...
I'm not sure what to look for - I have the VSS object, with which I can require additional services (such as TFS/WorkItemTracking/Services or TFS/WorkItemTracking/RestClient).
I found some examples like this one, but couldn't find an API to retrieve or query work items.
Do I need a JS object for that, or is it accomplished via some REST call?
You are nearly there.
You need the WIT RestClient (assuming you are using Typescript):
import { WorkItemTrackingHttpClient, getClient } from "TFS/WorkItemTracking/RestClient";
With that you can do
const witClient = ((getClient()) as WorkItemTrackingHttpClient);
and then
const result = await witClient.queryByWiql({ query: query });
The WorkItemTrackingHttpClient is all you need to manipulate work items.
EDIT: You could also have a look at the new SDK and API. But unfortunately its lacking a lot on the documentation side. Although there are some samples.
To query work items, you can can also check this page for WorkItemTrackingHttpClient2_2 client API.
IPromise<Contracts.WorkItemQueryResult> queryById(id, project, team)
IPromise<Contracts.WorkItemQueryResult> queryByWiql(wiql, project, team)
This is also an example about how to get WorkItemTrackingHttpClient and to call Api on Microsoft docs site.

protractor - after browser.restart basePage.js ref is lost

I am automating angularjs application which is based on basic authentication.
after every test i need to delete cookies and restart my browser so that i can login with different user.
To do this i am using browser.restart() method of protractor
However whenever i perform browser.restart(), my basePage.js references are lost and eventually i get 'This driver instance does not have a valid session ID'
my framework structure is as below
features
--feature1
pages
-page1.js
-page2.js
--basePage.js
step_definations
--step1.js
support
--world.js
--hooks.js
i am using
cucumber-js
javascript language
POM
protractor 5 version
nodejs
After reading lots of posts, i got to know about reinitialize basePage.js in world.js so that its references are recreated. But i am not able to understand how to do this?
for session
browser.executeScript('window.sessionStorage.clear();
If you found cookies is only issue
try this
browser.driver.manage().deleteAllCookies();

How to get List Of Connected Users in Google Plus via phonegap

My project requires me to get the list of connected users to the account.
I saw that i can do it using this
GET https://www.googleapis.com/plus/v1/people/me/people/connected?key={YOUR_API_KEY}
however, im having problems on how to supply YOUR_API_KEY
I tried this
https://github.com/EddyVerbruggen/cordova-plugin-googleplus
and was able to acquire the oauthtoken but it doesnt appear to be the api_key.
note : obj.idToken is always null so im only able to get the oauthtoken.
if someone could point me in the right direction that would be a great help.
Thanks,
Jay
There is some mistake in documentation. You need to use webApiKey param instead of webClientId. Look at GooglePlus.java in your Cordova plugin directory - how your JS params are put to Google Api.

Facebook OAuth 2.0 Javascript SDK authResponse

I'm trying to upgrade our app to use the newest OAuth 2.0 Javascript code. In my app settings under "Migrations" I have everything enabled. (OAuth Migration, Upgrade to Requests 2.0, etc)
After calling FB.init with: oauth: true.
Then calling FB.getLoginStatus (same for FB.login) and checking my response object I have a response.session but not a response.authResponse? Anyone know of any settings I could have missed or what would cause the oauth FB calls not to return the authResponse like the documentation states?
response.status is there, but not response.authResponse.
it sounds like to me there is problem in your upgraded code.
To isolate the problem, create a new fb app, then use your upgraded code and see what happens. For the app, simply set the canvas url / site url. For all those "migration settings", just takes the default value.
With this, you can be sure that this is nothing caused by misconfigured of FB settings.
and if you get response.authResponse, then you can compare the current fb settings between these 2 fb apps.
As #Eddy Chan suggests in his comment, it sounds like the JS SDK isn't actually being instructed to use the new OAuth flow, probably due to a misspelling of the oauth: true parameter.

Categories

Resources