These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Issue with SSO

First post
Author
SJ Astralana
Syncore
#1 - 2015-01-06 02:27:37 UTC
With the following snippet of C# code which is executed on return from the SSO auth page, I am getting a 400 Bad Request on the last line of displayed code. I've referred to both Single Sign-On and EveLib sources and just don't see anything wrong. Ideas?

public ActionResult EveApiCallback(string code)
{
var query = string.Format("grant_type=authorization_code&code={0}", code);

var req = WebRequest.CreateHttp("https://login.eveonline.com/oauth/token");
req.Method = "POST";
req.Host = "login.eveonline.com";
var bytes = Encoding.ASCII.GetBytes(string.Format("{0}:{1}", ClientId, ClientSecret));
var encoded = Convert.ToBase64String(bytes);
req.Headers.Add("Authorization", "Basic " + encoded);
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = query.Length;
using (var writer = new StreamWriter(req.GetRequestStream()))
{
writer.Write(query);
}
var response = req.GetResponse();

Hyperdrive your production business: Eve Production Manager

SJ Astralana
Syncore
#2 - 2015-01-06 02:50:22 UTC
Sometimes I hate computers. It failed repeatedly for hours with an auth token not found, then the first time I tried it after posting the question I got prompted to re-authenticated and it worked.

Hyperdrive your production business: Eve Production Manager

CCP FoxFour
C C P
C C P Alliance
#3 - 2015-01-06 11:58:36 UTC
Yay technology! :D

@CCP_FoxFour // Technical Designer // Team Tech Co

Third-party developer? Check out the official developers site for dev blogs, resources, and more.