News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
C# SDK Cannot Authorize - Bad Request
Tags: sdk
Oct 19, 2018 at 10:51am   •   3 replies  •  0 likes
it-admin12325

Private App Authorization

Platform Type: Server/BOT (plan to surface MS BOT Framework in Glip)

Permissions: Glip, Read Contacts, Read Messages


I'm using the RingCentral Client C# SDK as shown on Github to authorize:

var oToken = await oRestClient.Authorize(cUserName, "", cPassword);


And I keep getting the same error: {"Call failed with status code 400 (Bad Request): POST https://developer.ringcentral.com also I can log into my RingCentral.com account with my credentials so why is authentication failing?


StackTtrace:

Message: Call failed with status code 400 (Bad Request): POST https://platform.devtest.ringcentral.com/restapi/oauth/token

StackTrace: at Flurl.Http.FlurlRequest.<HandleExceptionAsync>d__23.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)

at Flurl.Http.FlurlRequest.<SendAsync>d__19.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at Flurl.Http.FlurlRequest.<SendAsync>d__19.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Flurl.Http.HttpResponseMessageExtensions.<ReceiveJson>d__0'1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at RingCentral.RestClient.<Authorize>d__39.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter'1.GetResult()

at RESTAPI_Testing.Program.<Main>d__0.MoveNext() in ...Program.cs:line 53


3 Answers
answered on Oct 22, 2018 at 7:44pm  
1) Should I create a new app as other or Server-only (No-UI)? 

Generally you should stick to Server/bot app type if you are building a bot. This is because, we provide never expire tokens for bot apps. So you can forget about bot token refresh.


2) More importantly can I add the Glip permission to my app

Yes, when you create the app, you can specify Glip permission (no matter what app type you choose). Can't you? Let me know if you have difficulty on this


3) Will I still be able to integrate it into Glip?

Yes I think so but as I said I think you should stick to Server/bot app type.



Why do you dislike Authorization Code "Authorization Flow type" ? Is there anything prevent you from using it?


 0
answered on Oct 22, 2018 at 8:15am  
If my users are already authenticated via Glip/Ring Central App. Why can I not access posts and groups via the admin username password.  At this point I do not have an additional server component for authentication. 

1) Can this not be handled by the C# SDK? 

Also, documentation states
Please note: Glip App (mobile or desktop) does NOT have:

  • support for the RingCentral Sandbox API (cannot switch to 'developer mode');

  • does not have a 'Sandbox version'

2) Does this mean I cannot talk to the API from sandbox app?

3) Also if I do not have an authentication/authorization server other that Glip right now do I even need an OAuth Redirect URI?


 0
answered on Oct 19, 2018 at 4:57pm  
  **Q: Why does OAuth return "unauthorized for this grant type" error?**

  **A:** The error "unauthorized for grant type" occurs when your application is attempting to use an OAuth grant type that it is not approved to use. This often happens when your app requires the Authorization Code Flow but is attempting to use the Password Flow. See below for information in implementing Authorization Code Flow. For more information see [this Developer Community article](https://devcommunity.ringcentral.com/ringcentraldev/topics/unauthorized-for-this-grant-type-error).


  **Q: How to deal with "Unauthorized for this grant type" issue?**
  
  **A:** It probably means your app doesn't support password authorization flow. Please logon https://developer.ringcentral.com and confirm that your app has the following configuration: https://cloud.githubusercontent.com/assets/733544/18026560/b93e5356-6c7d-11e6-92a9-d35d28325e69.png

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us