Skip to content
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

Fixed VK authorization #1166

Merged
merged 1 commit into from
May 25, 2021
Merged

Fixed VK authorization #1166

merged 1 commit into from
May 25, 2021

Conversation

Implx
Copy link
Contributor

@Implx Implx commented May 25, 2021

Список изменений

  • Исправлена авторизация вк

@inyutin-maxim inyutin-maxim linked an issue May 25, 2021 that may be closed by this pull request
@inyutin-maxim inyutin-maxim added the Pull Request Исправление внесенное пользователем не состоящим в основном списке разработчиков label May 25, 2021
@inyutin-maxim inyutin-maxim added this to the v1.64.0 milestone May 25, 2021
@inyutin-maxim inyutin-maxim merged commit 98e1674 into vknet:develop May 25, 2021
@inyutin-maxim
Copy link
Member

Спасибо за проделанную работу
Добавлено к следующему релизу. Либо можете получить обновление из альфа канала: https://www.myget.org/F/vknet

@SanteR1
Copy link

SanteR1 commented May 26, 2021

@inyutin-maxim
вот такая ошибка "'windows-1251' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')" при авторизации из альфа канала

@Implx
Copy link
Contributor Author

Implx commented May 26, 2021

Опишите, пожалуйста, подробней ошибку с кодировкой, ОС, версия .net и т.п.

@SanteR1
Copy link

SanteR1 commented May 26, 2021

@Implx
Win10x64 версия 20H2 сборка 19042.985, .NET 5.0 (Core)
VKNet 1.63.0-618
VkApi api = new VkApi(services); ApiAuthParams auth = new ApiAuthParams() { ApplicationId = 4900000, CaptchaKey = null, CaptchaSid = null, Login = "+7111111111", Password = "pppppppp", Settings = Settings.All | Settings.Offline, TwoFactorAuthorization = null }; try { api.Authorize(auth); } catch { //error in screen //Message: //InnerException.StackTrace: // at System.Text.EncodingTable.InternalGetCodePageFromName(String name) // at System.Text.EncodingTable.GetCodePageFromName(String name) // at System.Text.Encoding.GetEncoding(String name) // at System.Net.Http.HttpContent.ReadBufferAsString(ArraySegment 1 buffer, HttpContentHeaders headers) }
error_vk net

@Implx
Copy link
Contributor Author

Implx commented May 26, 2021

До моей правки авторизации этой ошибки не было? По времени приблизительно неделю/две назад

@Implx
Copy link
Contributor Author

Implx commented May 26, 2021

Ошибку повторил. Добавьте регистрацию CodePagesEncodingProvider перед вызовом функций api:

System.Text.EncodingProvider provider = System.Text.CodePagesEncodingProvider.Instance;
System.Text.Encoding.RegisterProvider(provider);

@SanteR1
Copy link

SanteR1 commented May 27, 2021

@Implx
Добавил, теперь вот такая ошибка
Failed to determine page type from url: https://oauth.vk.com/auth_redirect?app_id=1111111&authorize_url=https%253A%252F%252Foauth.vk.com%252Fblank.html%2523access_token%111Dz1cee11ez3d554c5f4b66vv84eb8a454b555ffd6ad496dd5e43f455654654d206d406f5a5462432e456546e2%56765expires_in%253D0%2526user_id%345643543345f%2526email%253Dggggggggg%2540nnnnn.ru&redirect_hash=6f4xz6fg67c94e670e

@Implx
Copy link
Contributor Author

Implx commented May 27, 2021

Это я вчера исправил, обновитесь из альфа канала

@NitayTubi
Copy link

NitayTubi commented May 31, 2021

Hi, I have the same error, how can I get the fix from https://www.myget.org/F/vknet?
I must have an updated DLL now and can't wait to the next release.
Thanks :)

@Implx
Copy link
Contributor Author

Implx commented May 31, 2021

Hi, I have the same error, how can I get the fix from https://www.myget.org/F/vknet?
I must have an updated DLL now and can't wait to the next release.
Thanks :)

Hello. First of all you will need to install myget extension:
https://blog.myget.org/post/2019/08/29/myget-credential-provider-visual-studio-2019.html
Then you will need to open the Package Manager Settings and create a new package source with the MyGet url: "https://www.myget.org/F/vknet". From the Tools menu, select NuGet Package Manager, Package Manager Settings. Select Package Sources. Then click the plus button to add a new package source.
And finally open the NuGet package manager itself and select the new package source you added. Note that you will need Include prerelease checked to see any NuGet packages for the vknet feed. Hope it helps

@NitayTubi
Copy link

Thank you for your help :)
I updated to version 1.63.0-621. I'm working with .NET Framework 4.6.1, and the dependencies are:

image

I have this error:

image

If I update these dependencies to version 5.0.0.0, the error disappears but it breaks other dependencies in my project.
Any idea?

@rhiskey
Copy link

rhiskey commented Jun 1, 2021

@Implx
Добавил, теперь вот такая ошибка
Failed to determine page type from url: https://oauth.vk.com/auth_redirect?app_id=1111111&authorize_url=https%253A%252F%252Foauth.vk.com%252Fblank.html%2523access_token%111Dz1cee11ez3d554c5f4b66vv84eb8a454b555ffd6ad496dd5e43f455654654d206d406f5a5462432e456546e2%56765expires_in%253D0%2526user_id%345643543345f%2526email%253Dggggggggg%2540nnnnn.ru&redirect_hash=6f4xz6fg67c94e670e

Та же проблема и у меня на .NET Core 3.1
#1164 (comment)

@NitayTubi
Copy link

Thank you for your help :)
I updated to version 1.63.0-621. I'm working with .NET Framework 4.6.1, and the dependencies are:

image

I have this error:

image

If I update these dependencies to version 5.0.0.0, the error disappears but it breaks other dependencies in my project.
Any idea?

So, I have no idea why but it looks like this prerelease version requires .NET 5 and it's not possible for me to target it.
Is there any other solution to this authorization issue?

@inyutin-maxim
Copy link
Member

Thank you for your help :)
I updated to version 1.63.0-621. I'm working with .NET Framework 4.6.1, and the dependencies are:
image
I have this error:
image
If I update these dependencies to version 5.0.0.0, the error disappears but it breaks other dependencies in my project.
Any idea?

So, I have no idea why but it looks like this prerelease version requires .NET 5 and it's not possible for me to target it.
Is there any other solution to this authorization issue?

If your application has GUI, then you can use a web view for authorization see example, also you can try use VkNet.AudioBypassService

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pull Request Исправление внесенное пользователем не состоящим в основном списке разработчиков
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants