Hi,
I am using Google SSO to sign into application. i am able to login successfully into application. But I tried to use scope with this but it is showing error. It is taking me back to login page.
How can i add scopes. i added following code in startup.cs
private static GoogleOAuth2AuthenticationOptions CreateGoogleAuthOptions()
{
//return new GoogleOAuth2AuthenticationOptions
//{
// ClientId = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientId"],
// ClientSecret = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientSecret"]
//};
var options = new GoogleOAuth2AuthenticationOptions
{
ClientId = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientId"],
ClientSecret = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientSecret"]
};
options.Scope.Add("https://www.googleapis.com/auth/drive");
return options;
}
Thanks
6 Answer(s)
-
0
Hi @smartlayer,
Can you share which version you are using ?
- MVC 5.x & jQuery
- MVC 5.x & AngularJS
- ASP.NET Core & jQuery
- ASP.NET Core & Angular 5
-
0
Hi ,
I am using MVC 5.x & jQuery. ver 5.0
-
0
Hi,
The issue is that i want get data from google drive using ASP NET zero ( using Google SSO).
private static GoogleOAuth2AuthenticationOptions CreateGoogleAuthOptions() { var options = new GoogleOAuth2AuthenticationOptions { ClientId = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientId"], ClientSecret = ConfigurationManager.AppSettings["ExternalAuth.Google.ClientSecret"]
}; options.Scope.Add("https://www.googleapis.com/auth/drive"); return options; }
If i use normal code, it is working fine. i am able to login into the application, but if i add scope for google drive as shown in above code it gives NULL into login info in ExternalLoginCallback method as shown below.
public virtual async Task<ActionResult> ExternalLoginCallback(string returnUrl, string tenancyName = "") { returnUrl = NormalizeReturnUrl(returnUrl); var loginInfo = await _authenticationManager.GetExternalLoginInfoAsync(); ............ ............
-
0
maybe you need to tick some Drive checkbox on google platform?!
-
0
Hi,
I tested same with console application. It is working in console application but not in this.
-
0
Hi @smartlayer,
Your problem might be related to this <a class="postlink" href="https://stackoverflow.com/questions/22690949/asp-net-mvc-5-google-authentication-with-scope">https://stackoverflow.com/questions/226 ... with-scope</a>.
Probably it is not related to AspNet Zero.