Skip to content

Commit

Permalink
Oauth2 desktop (#255)
Browse files Browse the repository at this point in the history
* Implemented OAuth2 AuthorizeAsync.

* Fixed MvcOAuth2Authorizer bug preventing confidential clients from working.

* Updated readme and version.
  • Loading branch information
JoeMayo authored Feb 1, 2022
1 parent fc8a39a commit 42554be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
38 changes: 17 additions & 21 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

LINQ to Twitter is an open source 3rd party LINQ Provider (Twitter Library) for the [Twitter](https://twitter.com/) micro-blogging service. It uses standard LINQ syntax for queries and includes method calls for changes via the [Twitter API](https://dev.twitter.com/).

> Please take the LINQ to Twitter Survey at [https://bit.ly/2Luzbpt](https://bit.ly/2Luzbpt).
[![Standard](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Fstandard)](https://developer.twitter.com/en/docs/twitter-api)
[![Labs](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Flabs)](https://developer.twitter.com/en/docs/labs)
[![v2](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Fv2)](https://developer.twitter.com/en/docs/twitter-api)
Expand All @@ -12,22 +10,22 @@ LINQ to Twitter is an open source 3rd party LINQ Provider (Twitter Library) for

The following query returns search results where people are tweeting about LINQ to Twitter:
```C#
var twitterCtx = new TwitterContext(...);

var searchResponse =
await
(from search in twitterCtx.Search
where search.Type == SearchType.Search &&
search.Query == "\"LINQ to Twitter\""
select search)
.SingleOrDefaultAsync();

if (searchResponse != null && searchResponse.Statuses != null)
searchResponse.Statuses.ForEach(tweet =>
Console.WriteLine(
"User: {0}, Tweet: {1}",
tweet.User.ScreenNameResponse,
tweet.Text));
var twitterCtx = new TwitterContext(...);

var searchResponse =
await
(from search in twitterCtx.Search
where search.Type == SearchType.Search &&
search.Query == "\"LINQ to Twitter\""
select search)
.SingleOrDefaultAsync();

if (searchResponse != null && searchResponse.Statuses != null)
searchResponse.Statuses.ForEach(tweet =>
Console.WriteLine(
"User: {0}, Tweet: {1}",
tweet.User.ScreenNameResponse,
tweet.Text));
```
From a coding experience perspective, the `TwitterContext` type is analogous to the Entity Framework `DBContext`. You use the `TwitterContext` instance, `twitterCtx`, to access `IQueryable<T>` tweet categories. In the example above, the `Search` will give you the ability to search Twitter for tweets meeting some criteria.

Expand All @@ -46,11 +44,9 @@ In addition to being able to download from this site, you can also automatically

## Available Feature Set

See [Making API Calls](https://github.com/JoeMayo/LinqToTwitter/wiki/Making-API-Calls).
See [LINQ to Twitter v6 APIs]https://www.linqtotwitter.com/LINQ-to-Twitter-v6.html).

## For more info:

* follow [@JoeMayo](https://twitter.com/JoeMayo) for releases and related blog posts.
* follow [@Linq2Twitr](https://twitter.com/Linq2Twitr) for more detailed project information.

> Please take the LINQ to Twitter Survey at [https://bit.ly/2Luzbpt](https://bit.ly/2Luzbpt).
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>6.11.0</Version>
<Version>6.12.0</Version>
<Authors>Joe Mayo</Authors>
<Company>Joe Mayo</Company>
<Product>LINQ to Twitter for ASP.NET</Product>
Expand All @@ -19,8 +19,8 @@ This library has ASP.NET authorizers and SessionStateCredentialCache that you'll
<PackageReleaseNotes>
Note: In previous versions of LINQ to Twitter, this was included in the `linqtotwitter` package. In version 6, ASP.NET Core 5 support is a separate package with a dependency on `linqtotwitter` v6.0+.

- Added OAuth 2.0 Support, including a new MvcOAuth2Authorizer and OAuth2SessionStateCredentialStore.
- Fixed a bug with SessionStateCredentialStore.ClearAsync that prevented it from working.
- Added default desktop support for AuthorizeAsync in OAuth2Authorizer.
- Fixed bug in OAuth2Authorizer so that confidential clients now work properly.
</PackageReleaseNotes>
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/LinqToTwitter6/LinqToTwitter/LinqToTwitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<Description>LINQ to Twitter is a 3rd party LINQ Provider that lets you tweet and query with the Twitter API.</Description>
<Version>6.11.0</Version>
<Version>6.12.0</Version>
<Authors>Joe Mayo</Authors>
<Company>Joe Mayo</Company>
<PackageId>linqtotwitter</PackageId>
Expand All @@ -17,7 +17,8 @@
<RepositoryUrl>https://github.com/JoeMayo/LinqToTwitter</RepositoryUrl>
<PackageTags>twitter twitterapi twitterdev tweet linq social linqtotwitter linq2twitter</PackageTags>
<PackageReleaseNotes>
- Added OAuth 2.0 support
- Added default desktop support for AuthorizeAsync in OAuth2Authorizer.
- Fixed bug in OAuth2Authorizer so that confidential clients now work properly.
</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
Expand Down

0 comments on commit 42554be

Please sign in to comment.