nemiro-net / nemiro.oauth.loginforms

OAuth login forms for Windows Forms projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nemiro.OAuth.LoginForms

Nemiro.OAuth.LoginForms is a class library that contains ready-to-use OAuth authorization forms for Windows Forms projects (.NET Framework).

It is an independent part of the Nemiro.OAuth project.

Nemiro.OAuth.LoginForms is licensed under the Apache License Version 2.0.

To install Nemiro.OAuth.LoginForms, run the following command in the Package Manager Console:

PM> Install-Package Nemiro.OAuth.LoginForms

System Requirements

  • Nemiro.OAuth v1.13 or later;
  • .NET Framework 3.5, 4.0, 4.5, 4.6 or 4.7;
  • Windows Forms.

License

Nemiro.OAuth.LoginForms is distributed under Apache License Version 2.0.

How to use

Create an authorization form for a provider OAuth. Use the Client ID and Secret Key that you received from the provider.

For example, DropBox:

C#

// create login form
var login = new DropboxLogin
(
  clientId     : "5nkunr8uscwfoba", 
  clientSecret : "n7x9icfwoe6dehq", 
  returnUrl    : "https://oauthproxy.nemiro.net/",
  autoLogout   : false,
  loadUserInfo : false
);

login.Owner = this;

// show login form
login.ShowDialog();

// authorization is success
if (login.IsSuccessfully)
{
  // use the access token for requests to API
  MessageBox.Show(login.AccessToken.Value);
}

Visual Basic .NET

' create login form
Dim login As New DropboxLogin _
(
  clientId     := "5nkunr8uscwfoba", 
  clientSecret := "n7x9icfwoe6dehq", 
  returnUrl    := "https://oauthproxy.nemiro.net/",
  autoLogout   := False,
  loadUserInfo := False
)

login.Owner = Me

' show login form
login.ShowDialog()

' authorization is success
If login.IsSuccessfully Then
  ' use the access token for requests to API
  MessageBox.Show(login.AccessToken.Value)
End If

Localization

Use the resources localization for different languages.

For example:

  • /ru/Nemiro.OAuth.LoginForms.resources.dll
  • /de/Nemiro.OAuth.LoginForms.resources.dll
  • Nemiro.OAuth.LoginForms.dll

This example will use the English (default), Russian and German.

See Also

About

OAuth login forms for Windows Forms projects.

License:Apache License 2.0


Languages

Language:C# 100.0%