-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth PKCE getting access token is not working #334
Comments
The As for the issue, it appears to be the same as #299 . We haven't merged that in to the SDK, but give that a try to see if it resolves the issue for you. |
I looked at the aforementioned problem and the opening of the URI worked. As I mentioned in the problem, I use ASP .NET Core, so to handle redirection, I created an MVC controller. [ApiController]
[Route("ieiApi/[controller]/[action]")]
public class RedirectController : Controller
{
public RedirectController()
{
//Do stuff... (e.g Assign variables)
}
public IActionResult Index()
{
return BadRequest();
}
[HttpGet]
public IActionResult Authorize([Bind("code")] string code, [Bind("state")] string state)
{
//Do stuff for check state and return code internally.
return Ok();
}
} In the constructor of a service that uses public Service(IHttpContextAccessor accessor)
{
//Get base uri.
var baseUri = accessor.HttpContext.Request.Host.Value;
//Combine com redirect path
string redirectURI = $"{baseUri}/ieiApi/Redirect/Authorize";
//Do stuff com redirectUri....
} Now, I was in doubt with the authorize URI, is it possible to make it so that, when opened, it goes straight to redirect? Without asking permission for the user? |
@JPPlaysGamer It's not possible to force it to do so, but Dropbox will automatically redirect the user to the redirect URI without having them manually click through under certain conditions, such as if they've already authorized the app, they don't have multiple accounts to pick from, and the redirect URI uses https. In any case, it's worth noting that you don't need to process the app authorization flow every time. Access tokens and refresh tokens can be stored and re-used without sending the user through the flow again. |
Before you start
Have you checked StackOverflow, previous issues, and Dropbox Developer Forums for help? Yes
What is your question?
I'm using the OAuth PKCE example to receive an access token, everything works fine, however an
HttpListenerException
is thrown saying:Access is denied
. For that I changed theLoopbackHost
value (127.0.0.1
) tolocalhost
, that worked, but inSystem.Diagnostics.Process.Start()
it threw aWin32Exception
saying it cannot find the specified file.So some questions to try:
LoopbackHost
?System.Diagnostics.Process.Start()
? Do you have any alternative to open the URL?HttpListener
structure? (I'm referring to those two redirection methods defined inProgram.cs
)Versions
Additional context
That existing SDK example I refer to was added 2 years ago and this SDK is up to date, I think something has changed. (Wouldn't it be better to update all examples?)
The text was updated successfully, but these errors were encountered: