public async Task <ActionResult> IndexAsync(CancellationToken cancellationToken) { var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()). AuthorizeAsync(cancellationToken); if (result.Credential != null) { //Ja estem autoritzats i podem cridar el servei de google var service = new Google.Apis.Oauth2.v2.Oauth2Service(new BaseClientService.Initializer() { HttpClientInitializer = result.Credential, ApplicationName = "Authentication API Sample", }); UserinfoResource.GetRequest userInfo = service.Userinfo.Get(); Google.Apis.Oauth2.v2.Data.Userinfoplus res = userInfo.Execute(); /** * A la variable res tenim tota la informació de l'usuari */ return(View("UserInfo", res)); } else { return(new RedirectResult(result.RedirectUri)); } }
public MeResource(Oauth2Service service) { this.service = service; }
public V2Resource(Oauth2Service service) { this.service = service; this._me = new MeResource(service); }
public UserinfoResource(Oauth2Service service) { this.service = service; this._v2 = new V2Resource(service); }
public MeResource(Oauth2Service service, Google.Apis.Authentication.IAuthenticator _authenticator) { this.service = service; this._authenticator = _authenticator; }
public V2Resource(Oauth2Service service, Google.Apis.Authentication.IAuthenticator _authenticator) { this.service = service; this._authenticator = _authenticator; this._me = new MeResource(service, _authenticator); }
public UserinfoResource(Oauth2Service service, Google.Apis.Authentication.IAuthenticator _authenticator) { this.service = service; this._authenticator = _authenticator; this._v2 = new V2Resource(service, _authenticator); }