Getting a Oauth token from c# SDK

Getting a Oauth token from c# SDK

I hope this makes sense.  I am using the c#  SDK examples to write records to the CRM Leads.  While calling  While this is not all my code, I'm hoping its enough to get some help.  While calling recordOperations.CreateRecords(); it fails after trying to GetToken from the Token Store.
Here is the token I am saving
  1.  Token token = new OAuthToken(
  2.                 "xxxx.clientid.goes.here.xxxxx",
  3.                 "xxxx.clientsecret.goes.here.xxxx",
  4.                 "REFRESH/GRANT token",
  5.                 TokenType.GRANT,
  6.                 string.Empty);
  7.             TokenStore tokenStore = new CustomTokenStore();
  8.             tokenStore.SaveToken(user, token);
And I am sending this token into the SDKInitilizer.Initialize.  No errors at this point.  Next I try and create a lead.  When it gets inside of recordOperations.CreateRecords(); it tries GetToken and I've hard coded it to return exactly what was in the token object above.   CreateRecords throws an error for "invalid_code".    Here is what is in the log file
  1. 21-09-07 16:49:34 [INFO]: Initialization successful for Email Id : myemail@email.com in Environment : https://www.zohoapis.com.
  2. 21-09-07 16:49:47 [INFO]: Access Token has expired. Hence refreshing.
  3. 21-09-07 16:49:50 [ERROR]: Exception in authenticating current request : {"Code":"INVALID CLIENT ERROR","Message":"invalid_code","Cause":null,"Details":null,"StackTrace":"   at Com.Zoho.API.Authenticator.OAuthToken.ParseResponse(String response)\r\n   at Com.Zoho.API.Authenticator.OAuthToken.RefreshAccessToken(UserSignature user, TokenStore store)\r\n   at Com.Zoho.API.Authenticator.OAuthToken.Authenticate(APIHTTPConnector urlConnection)\r\n   at Com.Zoho.Crm.API.Util.CommonAPIHandler.APICall[T](Type className, String encodeType)","Data":{},"InnerException":null,"HelpLink":null,"Source":"ZCRMSDK","HResult":-2146233088}
It appears to be failing when it tries to refresh the token so I assume I am not sending in the right info in the token object?




                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now