In order to connect to GBS APIs a valid access token is needed. To get a valid access token you will need to request a new consumer key and secret key to connect to Autodesk Oauth server. Please see GBS API Getting Started to learn how to get your consumer and secret key for the application you want to develop.
Sample code for getting Access Token |
string username = @"johndoe"; string oauth_consumer_key = @"sdsv40dsd89a7pf4s"; string oauth_consumer_secret = @"1fsadodsdst5ca0fn9kq"; string password = @"Password"; string requestToken = ""; string requestTokenSecret = ""; string authorizeToken = ""; string verifier = ""; string accessToken = ""; Dictionary<string, string> requestTokenResponseParamter = new Dictionary<string, string>(); Dictionary<string, string> authorizeTokenResponseParamter = new Dictionary<string, string>(); Dictionary<string, string> accessTokenResponseParamter = new Dictionary<string, string>(); Dictionary<string, string> validateTokenResponseParamter = new Dictionary<string, string>(); OAuthAuthorizationManager om = new OAuthAuthorizationManager(oauth_consumer_key, oauth_consumer_secret); requestTokenResponseParamter = om.GetRequestTokenParamters(); requestToken = requestTokenResponseParamter["oauth_token"]; requestTokenSecret = requestTokenResponseParamter["oauth_token_secret"]; authorizeTokenResponseParamter = om.GetAuthorizeTokenParamters(requestToken, username, password); authorizeToken = authorizeTokenResponseParamter["oauth_token"]; verifier = authorizeTokenResponseParamter["oauth_verifier"]; accessTokenResponseParamter = om.GetAccessTokenParamters(authorizeToken, requestTokenSecret, verifier); accessToken = accessTokenResponseParamter["oauth_token"]; |