Thinking of doing a full course on Google Authentication in ASP.NET Core. Let us know which areas you would like to be covered.
@muraterkan32517 ай бұрын
Bro it ferfect but mor than perfect. please explain bigger size. Your screen resulation so b big.
@donaldlee67604 жыл бұрын
Very nice explanation - thank you. I successfully added Google authentication to my asp.net core 3.1 app using your video. Next step is to add a logout button.
@RoundTheCode4 жыл бұрын
That's good to hear. It's good that ASP.NET Core has it's own NuGet packages for authentication.
@chandankarmakar66514 жыл бұрын
Hi, can you tell us how to add a logout button?
@iyashasgowda4 жыл бұрын
@@chandankarmakar6651 Steps for logging out : 1. Redirect the user to the login page. 2. Clear the saved cookie on logout button clicked.
@nontin212 жыл бұрын
Hello, thanks for the guide. everything works fine when i run the app in local. so after i published it and i test it online, the google auth opens, but it never hits my controller, i get an error. do you have any idea why? do i have to publish the App in google.console to make it run in my live website? Google login works local, but doesn't work live. for example: domain/signin-google returns error 500 for the live website, but localhost:port/signin-google hits my ExternalLogin Controller.
@RoundTheCode2 жыл бұрын
Have you added your live domain as an "Authorised Redirect URI"?
@RoundTheCode2 жыл бұрын
So you should create a new "Authorised Redirect URI" of {livedomain}/signin-google.
@nontin212 жыл бұрын
@@RoundTheCode yes i have. I get redirected to aoth page i select my gmail account from the list then i get error 500 and it never hits my controller to receive the login info. Local it works
@RoundTheCode2 жыл бұрын
@@nontin21 And I'm assuming your live domain is on HTTPS? You probably need to get the inner exception of the 500 error to diagnose it further. If you're not sure how to do that in a production environment, you can follow this tutorial that allows you to write errors to a text file: kzbin.info/www/bejne/f2TXnXakaq9spqM
@renjuag82798 ай бұрын
Please provide solution on this, Getting the same 500 error in production
@ilyachudinovskikh5713 жыл бұрын
I dont often write comments on youtube, but you did a great job and that is the best youtube guide for this kind of stuff. Thanks a lot and shoutout from Russia!)
@RoundTheCode3 жыл бұрын
Thanks Ilya.
@fredrickamoako Жыл бұрын
I cannot see how and why clicking on privacy link would direct a user to the google signin page, how it was setup to provide that functionality currently boggles my mind. Can you provide a clear explanation as to how it's setup to function that way? I have carefully gone through the code shared on the github repo and I can't see anything but it works fine.
@RoundTheCode Жыл бұрын
The HomeController is fixed with the [Authorize] attribute. Therefore any action within that controller requires authentication before being authorised to view the page. The Index page doesn't require it as it has the [AllowAnonymous] attribute assigned to it. Action attributes take more priority than controller attributes. In Startup.cs, we have configured authentication to go through Google. This uses functionality in the Microsoft.AspNetCore.Authentication.Google NuGet package to handle authentication when it's required.
@HaoNguyen-km9xj3 жыл бұрын
Is the .net web API can do like that.....I have a mobile app with flutter, the backend is .net 5 web API and in flutter I have implement google sign in with firebase , how can I implement the API match with flutter,...
@RoundTheCode3 жыл бұрын
Hi Hao. Not sure to be honest. Never had any experience with Flutter.
@Thephoenix7774 жыл бұрын
I don't have the fields you have, when i go to select internal vs external it talks about test users, not "everyone" I don't want to specify test users. Please ensure to elaborate on that.
@RoundTheCode4 жыл бұрын
Not sure if I follow what you are saying?
@SvenLowry3 жыл бұрын
@@RoundTheCode The "Internal / External" users choice when managing consent has changed now. The External option wording now mentions that to start with, your app is in "test" mode and will only allow whitelisted test accounts to login until you publish it.
@gorkemgenarakkaya45703 жыл бұрын
I encounter cors error when i run the project with angular although added the cors policy. Do you know how to fix?
@RoundTheCode3 жыл бұрын
Hi Görkem, The CORS policy is the fix! So it's probably your implementation that isn't quite right. Make sure that the host of your Angular application is inside the CORS middleware in your API. Check out our article for more information. www.roundthecode.com/dotnet/getting-started-with-cors-in-asp-net-core
@gorkemgenarakkaya45703 жыл бұрын
@@RoundTheCode Ok thank you so much for support. Im gonna check this out
@jose.salgado2 жыл бұрын
Hi! I'm getting also a CORS issue using react. It seems be on the redirect: Access to XMLHttpRequest at 'accounts.google.com/o/oauth2/v2/auth?etc') from origin 'localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Do you have any idea what could be?
@ranjitumakanthan9943 жыл бұрын
I tried and its working, Thank you for the detailing explanations
@RoundTheCode3 жыл бұрын
Good to hear Ranjit.
@rvcits3 жыл бұрын
Good day sir. Can you please have tutorial of google authentication in ASP.NET Core in .NET 6. I encounter a problem after I get authenticated. Please help me
@RoundTheCode3 жыл бұрын
Thanks for your comment Roberto. I will bare that idea in mind when planning for my next videos.
@md.tahmidmozaffar91353 жыл бұрын
I just started learning ASP Net Core stuff last month. This is just what I was looking for. Thank you very much. Subscribed.
@RoundTheCode3 жыл бұрын
Good to hear. Also, check out our new code examples page at www.roundthecode.com/code-examples.
@lamax8473 жыл бұрын
Why authorization in url "/account/google-login" if we set authorized redirect uri "/sigin-google"? How it worls?
@RoundTheCode3 жыл бұрын
So, "/account/google-login" sets a challenge which redirects to the Google Login screen. I'm assuming in the "Microsoft.AspNetCore.Authentication.Google" library, it has a "/signin-google" endpoint set up that looks out for the response from Google. From there, it can authenticate the user, and that allows us to display the claims returned from Google.
@lamax8473 жыл бұрын
@@RoundTheCode thanks, now i understand
@paoluccij3 жыл бұрын
in NET CORE 5 not have "Controllers Folder",
@RoundTheCode3 жыл бұрын
Hi Jose, ASP.NET Core in .NET 5 does have the controllers folder when you create an MVC app. See our video on dependency injection which is an ASP.NET Core in .NET 5 MVC app. kzbin.info/www/bejne/e5updmiaZ9F2jJY
@aminarifovic80282 жыл бұрын
First of all thank you for the great guide but just one question. How do you let others access the google login from different systems.
@RoundTheCode2 жыл бұрын
With your Google project, you'd have to set up a separate sign in URL for each system I believe.
@johnfox49142 жыл бұрын
I don''t understand. The things you do should not works because the redirect Uri you provide in the console googleCloud does not match any of your API URL...
@RoundTheCode2 жыл бұрын
It won't. The "/signin-google" endpoint is setup within the Microsoft.AspNetCore.Authentication.Google package.
@mdakatt2 жыл бұрын
Thanks a lot, its works you saved me hours to deal with Authentication roles and databases n just use this service ♥that
@RoundTheCode2 жыл бұрын
Good to hear Tait.
@ankxnjst3 жыл бұрын
Would this work on asp net core web application(without MVC)?
@RoundTheCode3 жыл бұрын
You can add the GoogleAuthentication plugin into any ASP.NET Core application. The question would be how you would build the login page to challenge Google.
@prabdeepdhaliwal97253 жыл бұрын
Hey, thanks for the video! For some reason after I sign in via google, I am not redirected anywhere... It just shows that I've signed in on the google button, but I'm still on the login page. Also I tried to manually type in an authorized route to see if I'm authenticated but it results in this error: NullReferenceException: Object reference not set to an instance of an object. on this line: var claims = result.Principal.Identities Any idea what may be the problem?
@RoundTheCode3 жыл бұрын
Hi Prabdeep, Couple of things to check. - Have you input the authorized redirect URI (3:32 in the video)? Make sure the host & port number are the same as your application. Also, check it's https as well. - Try a different browser. An ad blocker may be preventing it. - Make sure the client ID & secret are correct in your ASP.NET Core application. The reason for your NullReferenceException is because Google hasn't successfully authenticated the user.
@ehtishamakram44372 жыл бұрын
same issue
@danielluigi79523 жыл бұрын
What if I've more than 1 Login method(1. Google Auth, 2. Login via Database) and I want to let the user pick which method to use in order to login?
@RoundTheCode3 жыл бұрын
As mention on our Discord server to you, Identity Server has a lot of stuff to do with roles and permissions. You can use it with ASP.NET Core middleware like Google authentication.
@onurtekin80182 жыл бұрын
'Exception: The oauth state was missing or invalid.' i stuck with this error :/
@RoundTheCode2 жыл бұрын
Hi Onur, Make sure that the value in RedirectUri is routing properly. Otherwise, you'll need to share your code in GitHub as it's difficult to understand what's gone wrong.
@ilkayyGul3 жыл бұрын
How do I save the values in google response to the database?
@RoundTheCode3 жыл бұрын
You could do it in the normal way. Either by using Entity Framework, or ADO. You have the claims in your app, so you can do what you want with them.
@ilkayyGul3 жыл бұрын
@@RoundTheCode Thank you , Is there an instructional video?
@2k7Bertram2 жыл бұрын
The RedirectUri doesn't work for me. That route function is never called. Just keep going back to the GoogleLogin()
@RoundTheCode2 жыл бұрын
Hi Andre, you have added the RedirectUri into your Google Cloud account?
@2k7Bertram2 жыл бұрын
@@RoundTheCode Yes...that appeared to be the issue. 😅 Both Google OAuth and .NET Core are new to me. After I did so everything became clear. Thanks for this awesome tutorial!
@RoundTheCode2 жыл бұрын
@@2k7Bertram Thanks Andre. Glad you got it sorted.
@AlThePal782 жыл бұрын
Should definitely make the solution section smaller so that we can see the whole code. I have to bring in the using Microsoft.AspNetCore.Authentication.Cookies; because I am using VS 2022. Additionally, since that is different how did you create this project. I know it is a MVC but did you use no authentication in it that is not at all in the description. Your video is great so I am trying to make sure I know exactly what you're doing
@RoundTheCode2 жыл бұрын
I'd recommend you download the sample for it, then you can see the project for yourself. www.roundthecode.com/asp-net-core-examples/google-authentication-example-mvc-application
@AlThePal782 жыл бұрын
@@RoundTheCode I’m the same guy from the server I should delete this
@AlThePal782 жыл бұрын
@@RoundTheCode thanks for replying I now have to make work with my database and add what I need to so I can work with what I need for this to add the proper values to my database section
@elija.3 жыл бұрын
what about getting the code to create access token?
@RoundTheCode3 жыл бұрын
I will have to look into that. But you can probably stick a breakpoint on the "result" variable in AccountController > GoogleResponse, and it's probably buried somewhere in that "result" instance.
@elija.3 жыл бұрын
@@RoundTheCode i tried it already nothing there. i did it with another method. thanks anyways
@aniljain502 жыл бұрын
If I press back button and re authenticate then I get exception: An error was encountered while handling the remote login.
@RoundTheCode2 жыл бұрын
Hi Anil, You'll need to share your code as I'm not sure why you are getting that error.
@anilkumarmootha37382 жыл бұрын
Hi, Its the same code whatever you shared. Between, how do I share my code. Here itself?
@RoundTheCode2 жыл бұрын
@@anilkumarmootha3738 No you will need to create a GitHub repo and push it to that.
@raghavgupta75793 жыл бұрын
Hi sir, When we run our application and log in using google authentication so I occure "corelaton failed" error and object refrence set null
@RoundTheCode3 жыл бұрын
Hello Raghav, Please join our Discord server at roundthecode.com/discord, and share your code in a GitHub repository so we can have a look at it in a bit more detail.
@sowmyas56063 жыл бұрын
Is applicable for asp.net Web API ?
@RoundTheCode3 жыл бұрын
You wouldn't have cookie authentication on an ASP.NET Core Web API. Instead, you would use something like OAuth security for that. Checkout our videos on that topic: kzbin.info/www/bejne/rKWwpX-micehe5o
@sowmyas56063 жыл бұрын
@@RoundTheCode ok thanks
@aniljain504 жыл бұрын
Excellent tutorial and very simple!!
@RoundTheCode3 жыл бұрын
Thanks for your comments.
@dipanchhabra3 жыл бұрын
hey so, if anybody's listening it is not giving login option, if anybody could help, would be greatly appreciated.
@RoundTheCode3 жыл бұрын
Hi Dipan, You will need to explain more as to what problem you are having. What error message are you getting? If you wish, join our Discord server at roundthecode.com/discord and chat about it in there.
@dipanchhabra3 жыл бұрын
@@RoundTheCode I'll join for sure, I followed each and every step, there was no error but when I run the app it doesn't show the login page!!
@dipanchhabra3 жыл бұрын
@@RoundTheCode i have just started, so if you could keep your language simple I would be very much thankful
@ajmitaoufik3 жыл бұрын
i have this error help me An unhandled exception occurred while processing the request. Exception: Correlation failed. Unknown location Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync()
@RoundTheCode3 жыл бұрын
Not sure. Are you able to provide more details? When is this error occuring?
@pranjalchaudhari49273 жыл бұрын
"The oauth state was missing or invalid. An error was encountered while handling the remote login" in facebook external login when try to login with another facebook id apart from developer id and my developer id logged in successfully but apart from that no other fb id login always get this error message. I also have google login and it is working fine can you solve why this happens
@RoundTheCode3 жыл бұрын
Hey Pranjal, Join us on our Discord server at roundthecode.com/discord. Put your code into a GitHub repo & share the link on our Discord server so we can have a look for you.
@iyashasgowda4 жыл бұрын
Thank you for explaining google authentication in very simple way, hope you might do Microsoft authentication too in next videos
@RoundTheCode3 жыл бұрын
It will be similar to Google from an ASP.NET Core point of view. But, you will have to set up an app with Microsoft for the client Id/secret.
@iyashasgowda3 жыл бұрын
@@RoundTheCode Thanks, I was able to implement microsoft login.
@hoangnguyenhuy22103 жыл бұрын
I did, but the url in my google-login return null. Help me ,please
@RoundTheCode3 жыл бұрын
Hi Hoàng, Not really too sure what you mean by this. If recommend sharing your code on GitHub. Then, join us on our Discord server at roundthecode.com/discord and share the GitHub repository on there. Thanks.
@danielluigi79523 жыл бұрын
What about logout option?
@RoundTheCode3 жыл бұрын
As mentioned on our Discord server to you, you can sign out using HttpContext.SignOutAsync();
@pgoodboy33 жыл бұрын
How can I use role based authentication with google auth ?
@RoundTheCode3 жыл бұрын
Hi Pejoyable. It's not something we have looked into, but doing a search on Google may help you find your answer.
@mrohailiqbal2 жыл бұрын
Very informative. Keep up the good work bro :)
@RoundTheCode2 жыл бұрын
Thanks Rohail.
@333pendejo3 жыл бұрын
Hello. I would like to thank you for such good help material that you share with us. Could you help me with something, I don't know why it gives me "Object Reference not set an instance of an object"? Do you know why it is? I have a version of 3.4 Net.core and Microsoft Aspnetcore.authentication.google of 3.1.15
@RoundTheCode3 жыл бұрын
Hi Diana. You've created an object, but not created a new instance of it. You need to call the new keyword to create a new instance of it.
@Usman-fm2se4 жыл бұрын
Thank you for such a great video, it was very informative but I need your little bit of help, could you please explain how I get OAuth access token after "google-response"...
@RoundTheCode4 жыл бұрын
My example is using Cookie authentication rather than OAuth authentication. If you want to get the claims principal after google-response, you can call HttpContext.User which is where it's stored.
@rohinirohini532 Жыл бұрын
How to add this google sign in login page
@RoundTheCode Жыл бұрын
Yes that is what this video is about.
@AlThePal782 жыл бұрын
I don't understand why you just don't go to nuget packages and this?
@RoundTheCode2 жыл бұрын
It's good to get an understanding of how it works and how to configure it.
@AlThePal782 жыл бұрын
@@RoundTheCode I see what I wrote makes no sense I was talking about adding the nuget package through nuget vs typing the commands. For a beginner like me I think it would make sense to go through the manager so when I browse and search, it knows what to do with my mistakes if any when typing :)
@sanjayprajapati35403 жыл бұрын
This is what i was actually looking for , thanks
@RoundTheCode3 жыл бұрын
Thanks for your comment, Sanjay.
@sunwado4 жыл бұрын
Excellent video very informative
@RoundTheCode4 жыл бұрын
Glad it was helpful!
@MattDoesGaming63 жыл бұрын
You're so awesome, you really know your stuff, great content :)
@RoundTheCode3 жыл бұрын
Thanks Matt.
@umeshshelke725 Жыл бұрын
Can you please make tutorial on Facebook Authentication using asp net core identify core?
@RoundTheCode Жыл бұрын
Already done one some years back. kzbin.info/www/bejne/rqvGdaKLhd5rg80
@cissemy3 жыл бұрын
Thanks How to add google authentication into .net core web api ?
@RoundTheCode3 жыл бұрын
This is more for cookie authentication then using it for an API. You would probably want to focus going down the OAuth route for API authentication. This is where you give a client ID & secret to the client, and it generates an authorisation code & bearer token.
@truonghoanglong69412 жыл бұрын
Hello, your videos is amazing and it help me a lot. But i want to ask that after login, how can i log out of that account to log in using another account? Can you give me some idea on how to do it, i'va try many thing but it doesn't seem to work
@RoundTheCode2 жыл бұрын
Have you tried HttpContext.SignOutAsync(); ?
@marcioaugusto3924 жыл бұрын
Thank you so much for this instructional video. Helped me a lot
@RoundTheCode4 жыл бұрын
You're welcome!
@JuanPabloUribeRodas3 жыл бұрын
Hi, Thank you very much, excellent explanation
@RoundTheCode3 жыл бұрын
Thanks for your comments.
@amalchacko87842 жыл бұрын
Thanks for the tutorial
@RoundTheCode2 жыл бұрын
Thanks Amal.
@hanh.trinh.yeu.thuong3 жыл бұрын
It's very usefull! Thank you! :)
@RoundTheCode3 жыл бұрын
Thanks for the comment.
@adheeshadeshan6084 жыл бұрын
Thanks RTC very helpful
@RoundTheCode4 жыл бұрын
Happy to help
@dyraksa136884 жыл бұрын
thank for share your knowledge
@RoundTheCode4 жыл бұрын
My pleasure
@deepakpandey94063 жыл бұрын
This guy sounds like Jon Skeet 😂
@RoundTheCode3 жыл бұрын
That because it is me. Jon Skeet. I just got a mask on 🤣
@rahultnna91983 жыл бұрын
great steps
@RoundTheCode3 жыл бұрын
Thanks Rahul
@krakxp4 жыл бұрын
Its works, Vive!!! Viveee!!! Muajajajaja muajajaja Thank you!!!!!!
@RoundTheCode4 жыл бұрын
Good to hear. Thanks for your comments.
@emilioignaciovelezsaavedra31733 жыл бұрын
Thx!
@RoundTheCode3 жыл бұрын
Thanks for the comment.
@estebanconcha44244 жыл бұрын
Gracias
@RoundTheCode4 жыл бұрын
Thanks for your comments
@hafizabdulmajidwaseer86584 жыл бұрын
useless tutorial, till the end... you should elaborate real-life practical implementation of a live Demo Project...
@RoundTheCode4 жыл бұрын
Should I? Ok.
@hafizabdulmajidwaseer86584 жыл бұрын
@@RoundTheCode you should take these steps to follow: 1. Context of tutorial 2. Which Technology is being used / gonna implement 3. Show final product / result, in first place 4. Take fresh solution, to take-on 5. Tutorial, should've to cover all surrounding concepts i.e. related in this regards... e.g. #Authentication#Authorization etc. how these are implemented in a real-life example... You have to make series of videos, i.e. specifies particular context in broad-manner... !!! ... People like us, will glad to have this vary RICH contextual based series of Videos...
@yaozhang67664 жыл бұрын
This is concise and to the point for anyone looking to just get a skeleton code up and running, which is very appreciated. There are 5hr+ long video series out there already covering a lot more, but at that point it's faster to look at the msdn docs with their dotnet core samples.
@aniljain504 жыл бұрын
@@hafizabdulmajidwaseer8658 Instead of saying useless, you can put recommendations. Its a first step NEAT AND SIMPLE video towards oauth. We can respect the authors time.