Open Forum

 View Only

Oauth2 unauthorized with dotnet application

  • 1.  Oauth2 unauthorized with dotnet application

    Posted 2 days ago

    Title about sums it up.  I have a sandbox account set up, but I'm getting errors when trying to authorize it.

    I have a dotnet applicaton that is using the Cvent.SDK v1.5.1 nuget package. I have an application created inside of Cvent and have the client Id/Secret

    When trying to make an api call in the dotnet code I get an unauthorized error. Application is using the tokenUrl of "https://api-platform.cvent.com/ea/oauth2/token".

    I assumed this was because there must be a sandbox url for token auth since I have a sandbox account I'm trying to use. Therefore I tried the tokenUrl of "https://api-platform-sandbox.cvent.com/ea/oauth2/token". However that also didn't work.

    Here is an example of what I have on the code side.

    var sdk = new CventSDK(
        security: new Security()
        {
            OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials()
            {
                ClientID = _appSettings.CventSettings.ClientId,
                ClientSecret = _appSettings.CventSettings.ClientSecret,
                TokenURL = _appSettings.CventSettings.TokenUrl,
                Scopes = scopes
            },
        });

    I have confirmed the clientId and clientSecret match was is in my application tab on the cvent.developers site.

    The scopes value is being passed in by the various methods I have in my code. Current example I'm trying is scope = "event/attendees:read" to call the listAttendees endpoint.


    #EventApp

    ------------------------------
    Kristopher Karolchyk
    SalesforceGenericAccountUnited States
    ------------------------------