VatsimSSO 1.3.0

Install-Package VatsimSSO -Version 1.3.0
dotnet add package VatsimSSO --version 1.3.0
<PackageReference Include="VatsimSSO" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VatsimSSO --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VatsimSSO, 1.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install VatsimSSO as a Cake Addin
#addin nuget:?package=VatsimSSO&version=1.3.0

// Install VatsimSSO as a Cake Tool
#tool nuget:?package=VatsimSSO&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

VATSIM SSO

An OAuth 1.0 wrapper designed to easily implement the VATSIM SSO system in C# web applications.

Installation

PM> Install-Package VatsimSSO

Dependencies will be pulled at the same time.

Implementation

Initial login token

The code below will return the login token used to authenticate the user when redirecting to the SSO server (BaseUrl property defaults to https://cert.vatsim.net/sso/api).

// Client object
VatsimSSO r = new VatsimSSO("CONSUMER_KEY", "CONSUMER_SECRET", "CALLBACK_URI");

// Get the request token
var RequestToken = r.GetRequestToken();

The object returned is a custom SSOAuthRequest object which returns the token and result information. A redirect example in ASP.NET would look like this:

return Redirect("https://cert.vatsim.net/sso/auth/pre_login/?oauth_token=" + RequestToken.Token.oauth_token);

You can return the raw JSON string by returning the Raw property of the object.

Returned user data

The below code will return a JSON string of the information for the user that has just logged in, using the access token, secret and verifier.

// Client object
VatsimSSO r = new VatsimSSO("CONSUMER_KEY", "CONSUMER_SECRET", Token: oauth_token, Verifier: oauth_verifier, TokenSecret: oauth_token_secret);

// Json string
string Results = r.ReturnData().Raw;

An example of such JSON response would be:

{"request":{"result":"success","message":""},"user":{"id":"1300007","name_first":"7th","name_last":"Test","rating":{"id":"7","short":"C3","long":"Senior Controller","GRP":"Senior Controller"},"pilot_rating":{"rating":"0"},"email":"noreply@vatsim.net","experience":"N","reg_date":"2014-05-14 17:17:26","country":{"code":"GB","name":"United Kingdom"},"region":{"code":"USA-S","name":"South America"},"division":{"code":"CAM","name":"Central America"},"subdivision":{"code":null,"name":null}}}

You can also return an SSOReturnData object. This object contains already parsed user and result information as a C# object. Example:

// Return data object
var Results = r.ReturnData();

Please open up an issue if there are any problems or feel free to post on the forum thread.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 612 7/14/2018
1.2.0 558 7/7/2018
1.1.0 547 7/2/2018
1.0.0 582 7/1/2018

Updated to work in production, code refactored and updated.