fix: fix of redirect uri form issue
This commit is contained in:
parent
904fa634c6
commit
cc559a4aa3
@ -19,15 +19,8 @@ public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadH
|
|||||||
/// <returns>Link for auth</returns>
|
/// <returns>Link for auth</returns>
|
||||||
public string GenerateAuthLink(long userId)
|
public string GenerateAuthLink(long userId)
|
||||||
{
|
{
|
||||||
var redirectUri = new UriBuilder(_config.Links.HookDomain)
|
|
||||||
{
|
|
||||||
Port = -1,
|
|
||||||
Scheme = "https",
|
|
||||||
Path = _config.Links.HookRoute,
|
|
||||||
Query = $"?userId={userId}"
|
|
||||||
}.ToString();
|
|
||||||
|
|
||||||
return string.Format(_config.Links.AuthLink, [_config.ClientId, redirectUri]);
|
return string.Format(_config.Links.AuthLink, [_config.ClientId, GetRedirectUrl(userId)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Status> AuthUser(int userId, string authorizationCode, string? error)
|
public async Task<Status> AuthUser(int userId, string authorizationCode, string? error)
|
||||||
@ -47,7 +40,7 @@ public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadH
|
|||||||
{ "client_secret", _config.Secret },
|
{ "client_secret", _config.Secret },
|
||||||
{ "code", authorizationCode },
|
{ "code", authorizationCode },
|
||||||
{ "grant_type", "authorization_code" },
|
{ "grant_type", "authorization_code" },
|
||||||
{ "redirect_uri", HttpUtility.UrlEncode("/auth") }
|
{ "redirect_uri", GetRedirectUrl(userId) }
|
||||||
};
|
};
|
||||||
client.BaseAddress = new UriBuilder(_config.Links.HeadHunterApiDomain)
|
client.BaseAddress = new UriBuilder(_config.Links.HeadHunterApiDomain)
|
||||||
{
|
{
|
||||||
@ -98,6 +91,17 @@ public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadH
|
|||||||
return Status.Success;
|
return Status.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetRedirectUrl(long userId)
|
||||||
|
{
|
||||||
|
return new UriBuilder(_config.Links.HookDomain)
|
||||||
|
{
|
||||||
|
Port = -1,
|
||||||
|
Scheme = "https",
|
||||||
|
Path = _config.Links.HookRoute,
|
||||||
|
Query = $"?userId={userId}"
|
||||||
|
}.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public enum Status
|
public enum Status
|
||||||
{
|
{
|
||||||
UserAuthRejectedError,
|
UserAuthRejectedError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user