WeiboOAuth2.Provider
1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package WeiboOAuth2.Provider --version 1.0.1
NuGet\Install-Package WeiboOAuth2.Provider -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WeiboOAuth2.Provider" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WeiboOAuth2.Provider --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WeiboOAuth2.Provider, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WeiboOAuth2.Provider as a Cake Addin #addin nuget:?package=WeiboOAuth2.Provider&version=1.0.1 // Install WeiboOAuth2.Provider as a Cake Tool #tool nuget:?package=WeiboOAuth2.Provider&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WeiboOAuth2.Provider
Weibo OAuth 2.0 provider for .net core 2.0
github : https://github.com/ws-dotnet-core/WeiboOAuth2.Provider
nuget(current version) : https://www.nuget.org/packages/WeiboOAuth2.Provider/1.0.0
UPDATE
2017.10.02 : change the main namespace to "WeiboOAuth2.Provider", not "WeiboOAuth2.Provider.Src" .
Weibo OAuth 2.0
[T]: Implemented
[F]: Not implemented
OAuth2(Guider)VERSION 1.0.0
[T]Request authorization: oauth2/authorize
[T]Get authorization: oauth2/access_token
[F]Authorization Query: oauth2/get_token_info
[F]Replace authorization: oauth2/get_oauth2_token
[T]Authorization Recycle: oauth2/revokeoauth2
Other interfaces:
[F]account/rate_limit_status Gets the current authorized user API Access frequency limit
[F]account/get_uid To obtain a user's UID after authorization
[F]account/profile/email Get user's contact mailbox after authorization
[T]https://api.weibo.com/2/users/show.json get user infos
Package Manager
PM > Install-Package WeiboOAuth2.Provider -Version 1.0.0
.NET CLI
> dotnet add package WeiboOAuth2.Provider --version 1.0.0
Dependencies :
.NETStandard 2.0
Newtonsoft.Json (>= 10.0.3)
How to use:
1. Create options for WeiboOAuth2.0 and inject it into container
public class WeiboOAuthV2Option : IWeiboOAuthV2Option {
public string AppID => "your app id";
public string AppSecret => "your app secret";
}
// ...... then inject it.
services.AddScoped<IWeiboOAuthV2Option, WeiboOAuthV2Option>();
2. Then create your service
// new interface for web service provider
public interface IWeiboOAuthService<TUser> : IWeiboOAuthV2Provider<WeiboSuccessToken, WeiboUser> {
// add your code here.
}
public class WeiboOAuthService : WeiboOAuthV2Provider, IWeiboOAuthService<User> {
private YourDBContext db;
public WeiboOAuthService(YourDBContext db, IWeiboOAuthV2Option options) : base(options) {
this.options = options;
this.db = db;
}
}
// then inject it
services.AddScoped<IWeiboOAuthService<User>, WeiboOAuthService>();
3. Use in controller
public class IdentityController : Controller {
private YourDBContext db;
private IWeiboOAuthService<User> weibo;
public IdentityController(YourDBContext db, IWeiboOAuthService<User> WEOBO_SRV) {
this.db = db;
this.weibo = WEOBO_SRV;
}
4. Request authorization (frontend)
// example in typescript
public get WeiboAuth() {
// my regex tools : ws-regex (npm)
const href = Regex.Create(/htt.+\/\/.+?\//).Matches(window.location.href)[0];
return `${this.server.WeiboOAuthHost}/authorize?client_id=${this.server.WeiboClientID}&response_type=code&redirect_uri=${href}`;
}
5. Get authorization
var (result, succeed, error) = await this.weibo.GetWeiboTokenByCodeAsync(code, redirect_url);
6. Get userinfos
var (infos, succeed02, error02) = await this.weibo.GetWeiboUserInfosAsync(result.Uid, result.AccessToken);
7. Authorization Recycle
var (result, succeed, error) = await this.weibo.RevokeOAuth2Access(access_token);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Newtonsoft.Json (>= 10.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
2017.10.02 :
1. change the main namespace to "WeiboOAuth2.Provider", not "WeiboOAuth2.Provider.Src";
2. add document for some methods and fields;
3. add tests.