question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google token validation with local authentication

See original GitHub issue

Hey

First of all I should mention that you’re library is very good and makes it easier to validate Google token. As I am new to .net core a question raised in my mind.

I am currently having a .net core React application that is configured with local authentication with JWT.

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) 
                .AddJwtBearer(options => {
                                       options.TokenValidationParameters = new TokenValidationParameters
                                       {
                                           ValidateIssuer = true,
                                           ValidateAudience = true,
                                           ValidateLifetime = true,
                                           ValidateIssuerSigningKey = true,
                                           ValidIssuer = "yourdomain.com",
                                           ValidAudience = "yourdomain.com",
                                           IssuerSigningKey = new SymmetricSecurityKey(
                                               Encoding.UTF8.GetBytes("secret key"))
                                       };
                                   });


Now I want to add Google token validation and I was wondering to ask, will I be able to use your NuGet package and have my local authentication flow?

If I can would that be something like this?

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) 
                .AddJwtBearer(options => {
                                       options.TokenValidationParameters = new TokenValidationParameters
                                       {
                                           ValidateIssuer = true,
                                           ValidateAudience = true,
                                           ValidateLifetime = true,
                                           ValidateIssuerSigningKey = true,
                                           ValidIssuer = "yourdomain.com",
                                           ValidAudience = "yourdomain.com",
                                           IssuerSigningKey = new SymmetricSecurityKey(
                                               Encoding.UTF8.GetBytes("secret key"))
                                       };
                                   })
                .AddJwtBearer(x => x.UseGoogle(
                     clientId: "<google-client-id>",
                     hostedDomain: "<optional-g-suite-domain>"));

Cheers

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
khellangcommented, Oct 5, 2018

Hey @javahemans and @nazarkryp! Did you get anywhere with this? Can I close the issue?

0reactions
Mansour-Jcommented, Oct 6, 2018

yup, got it working

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticate with a backend server
An easy way to validate an ID token signature for debugging is to use the tokeninfo endpoint. Calling this endpoint involves an additional ......
Read more >
How can I verify a Google authentication API access token?
Verify that the ID token is a JWT which is properly signed with an appropriate Google public key. · Verify that the value...
Read more >
Using Google ID tokens to authenticate users
Using Google ID tokens to authenticate users ... This page describes how to support user authentication in Cloud Endpoints. To authenticate a user,...
Read more >
Verify ID Tokens | Firebase Authentication - Google
The Firebase Admin SDK has a built-in method for verifying and decoding ID tokens. If the provided ID token has the correct format,...
Read more >
How to use One-tap Google sign in, including ... - YouTube
You also learn how to pass the token to backend #expressjs application and validate that idTtoken for authentication.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found