Google Cloud Function Authentication using Oauth2 - oauth-2.0

What I have:
A google cloud function and an HTTP trigger like : https://us-central1-{project_name}.cloudfunctions.net/{function_name}.
Currently, I have set unauthenticated access by selecting allUsers in the permissions of the cloud function.
A web application that needs to call this cloud function.
What I want:
Implement authentication for this function.
Any step by step guide to implement Oauth 2 authentication for a google cloud function (without the need to add any code in the cloud function end) will be highly appreciated.

It seems I was doing something wrong and not thinking about this clearly.
I started from scratch and followed the link https://cloud.google.com/functions/docs/securing/authenticating and was able to generate the bearer token.
Thanks for the help in the comments section.

Related

Save user Auth Details from Clientside with Cloud Functions

I'm building a project in Vue, and I have Auth working on front end, but now I want to save some user data on Firebase Database and I am not sure how to do that using functions since I am doing a server-less backend.
I tried to find an example on how to be able to pass data from client-side to functions api but I couldn't find any.
Looking forward to receive any help from someone,
Regards,
Cheers
Firebase provides you a REST api to do this, check out their documentation in this link.

Swagger with AWS IAM user Access Key/Secret

I am trying out AWS API Gateway, and it's very easy to import/export API definition from Swagger.
However, I've set my API to require AWS_IAM authorization so it's not public. But I cannot find how to make it work with Swagger UI. It seems Swagger UI only takes API Key, instead of IAM user's Access Key and Secret for Sigv4 signing.
Does anyone know is there a way to configure Swagger UI to take in Access Key/Secret, and sign the request for AWS_IAM auth?
Any direction would be appreciated.
Thanks,
Swagger UI OOTB does not support AWS_IAM auth, however, there you can still accomplish Sigv4 Signing. How to calculate AWS signature V4 in Swagger before request gives two good examples on how to accomplish this.
I used the second example, in conjunction with the author's blog post to test with multiple user Access Key/Secrets. The blog post also goes into more detail on using the AWS JS SDK for this purpose.

Nancy Selfhosting and google authentication

I can't find any proper sample about
google (or facebook) authentication in case of using Nancyfx as a Self-Hosting program.
Advice needed.
Sorry there is no official code/sdk for Nancyfx.
But if you want to support basic "Sign in with Google" on any site the easiest is to add some code on the page (this can get you an id_token)
https://developers.google.com/identity/sign-in/web/
And send this id_token to your server and validate it on the server side. The code to validate is fairly simple. You can pick up the sample python or java code from here.
https://developers.google.com/identity/sign-in/web/backend-auth
This is probably the easiest way to get Google sign-in on a web based application.

How to implement Openid connect and Spring Security

I am beginner of authentication and authorization but I have to connect to a openid connect provider on my job. I know a little about how to use Spring Security.
First, I got UserInfo object thanks by following nice direction.
https://oauthssodemo.appspot.com/step/1
And then I found a great implementation named "spring-security-oauth" below. I could run the app on tomcat and connect to facebook successfully.
https://github.com/SpringSource/spring-security-oauth
As next step, I want to connect google by using "spring-security-oauth" but I do not know how to do that completely. (To be honest, I do not know how differences openid connect and aouth2..)
give me a clue. Any help will be appreciated.
here is a sample minimal project integrating Google Open Id Connect with Spring Security: https://github.com/fromi/spring-google-openidconnect
The key point for me was to rely heavily on Spring OAuth2 to minimize the configuration required.
The OpenID Connect basic essentials specification is for the time being at http://openid.net/specs/openid-connect-basic-1_0.html
For Spring specific details to implement individual steps, frame new questions further detailing the exact task w. r. t. this procedure.
You could use the spring-social-google projet to implement a "Sign in with Google" functionality. It's use OAuth 2.0 under the hood but right now it's use to Google+ API to retrieve profile informations. I did a fork to make it use the Google Authentification and Authorization API which is basicaly the openconnect Id standard

How to use OAuth2 in google-api-java-client?

I am trying to use the PredictionSample in google-api-java-client, but with ClientLogin authentication it gives me error:
User is not a trusted tester
I have activated the Google Prediction API in my APIs Console project. And I am able to run the Hello World prediction example from http://code.google.com/apis/predict/docs/hello_world.html with the same user. It uses oacurl and oauth2.
But it does not work with google-api-java-client. I am also not able to make oauth2 work with google-api-java-client.
I have searched the documentation and samples and have found no solution. Is it possible to do what is done in the hello_world example using the google-api-java-client.
I ran into a similar problem using Blogger API in my Google APP Engine Project. Attached is the link to the Stackoverflow question and sample code I was able to get working. Hope it helps.
Proper Form of API request to Blogger using Java/App Engine -error 401

Resources