Oauth Getting Profile MVC

May 16, 2014 at 7:04 PM
Hi There

I have created a controller in MVC5 that start the authentication process off like so

DiscogsAuth auth = new DiscogsAuth("Stoned4U/UserAgent", "EIdqvvcAOpfkNlpgJWlm", "wEAktIqLjDWANzZtDMdTvsDkTxUfxBrb");
Then in another controler after getting the auth code from discogs i post in the code like so
    public ActionResult GetMyAccount(FormCollection colection)
        var id = colection["id"];
        DiscogsAuth auth = new DiscogsAuth("Stoned4U/UserAgent", "EIdqvvcAOpfkNlpgJWlm", "wEAktIqLjDWANzZtDMdTvsDkTxUfxBrb");
        var authHeaders = auth.AuthorizeApp(id);
        UserAPI userInfo = new UserAPI("Stoned4U/UserAgent", "AuthHeader");
        return View();
@ var authHeaders = auth.AuthorizeApp(id);

i get this error.

Object reference not set to an instance of an object.

Can u shine any light for me please. i have left my app codes in as ill delete and renew later on. i dont know if it will help.

May 18, 2014 at 11:53 PM
Edited May 19, 2014 at 4:03 PM
Do you have the DiscogsAuth auth = new DiscogsAuth("XXXX/1.0.3 +http://ctkme.com", "YYYY", "ZZZ"); outside a public for exemple
Public Class frmMain

Public Auth As DiscogsAuth

Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles frmMain.Load
        Auth = New DiscogsAuth("XXXX/1.0.3 +http://ctkme.com", "YYYY", "ZZZ")
        'Form initialization code
End Sub

End Class
And the rest of the code... That seems to me the problem
You have to declare outside the Function the Auth as Public so It's acessible throught the app and then on the form or the first step of the authentication you need to atribute the object the "Auth = New DiscogsAuth("XXXX/1.0.3 +http://ctkme.com", "YYYY", "ZZZ")
May 18, 2014 at 11:56 PM
Just a question for you are you using the 1.6 Beta Binary or did you downloaded the source code?
May 19, 2014 at 4:22 PM
Hi there

I downloaded the 1.6 beta dll.

I will put the DiscogsAuth auth = new DiscogsAuth("Stoned4U/UserAgent", "EIdqvvcAOpfkNlpgJWlm", "wEAktIqLjDWANzZtDMdTvsDkTxUfxBrb"); as a public outside this scope and let u know.


thanks speak soon.