crowdin / mobile-sdk-ios

Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately
https://crowdin.github.io/mobile-sdk-ios
MIT License
117 stars 43 forks source link

Example can't authorize success. #144

Closed weberlisper closed 3 years ago

weberlisper commented 3 years ago

I create a project in crowdin, and replace distributionHash, sourceLanguage, clientId, clientSecret in SceneDelegate.swift file. After I run the Example, and click "Log in" but authorize failed. the status code is 401, and the error message is "Client authentication failed". I use the same configuration in android sample, but success.

denisqua commented 3 years ago

Hi @weberlisper !

I'm sorry for the issue you've faced with!

Please check the clientId, clientSecret and redirect URL in OAuth configuration on Crowdin.

Redirect URL should match your App scheme. For example, for <data android:scheme="crowdintest" /> redirect URL in Crowdin should be crowdintest://

Also, if you are using crowdin.com, not Crowdin Enterprise, organization_name in the SDK config should be null.

If after that, it still won't work, please provide the next details:

  1. short recorded video with all steps to reproduce
  2. your SceneDelegate.swift file (config file)
  3. project URL
denisqua commented 3 years ago

I personally have assumption that the root is a redirect URL (it should be crowdintest://) or you may try as on my screenshot:

3

weberlisper commented 3 years ago

I personally have assumption that the root is a redirect URL (it should be crowdintest://) or you may try as on my screenshot:

3

This is my redictURL: image And I copy crowdintest:// in SceneDelegate.swift file, but got error: image

weberlisper commented 3 years ago

I personally have assumption that the root is a redirect URL (it should be crowdintest://) or you may try as on my screenshot:

3

I try your screenshot, but failed: image

weberlisper commented 3 years ago

@denisqua Hello

denisqua commented 3 years ago

Let's go answer by answer:

  1. >And I copy crowdintest:// in SceneDelegate.swift file, but got error:

According to that one, seems it isn't necessary to have crowdintest:// in the SceneDelegate.swift file: https://github.com/crowdin/mobile-sdk-ios/blob/master/Example/AppleReminders/SceneDelegate.swift

So I kindly ask to remove it from the SceneDelegate.swift file (and do everything according to the documentation)

  1. >I try your screenshot, but failed:

Between first and second URLs I have coma, you put dot :)

but anyway, seems it's needed only crowdintest://

  1. Please, let me know whether you've added URL Scheme into Info.plist file: https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

If after removing callback from the config file and setting up URL Scheme inside info.plist file it won't work, I kindly ask you:

weberlisper commented 3 years ago

Let's go answer by answer:

  1. >And I copy crowdintest:// in SceneDelegate.swift file, but got error:

According to that one, seems it isn't necessary to have crowdintest:// in the SceneDelegate.swift file: https://github.com/crowdin/mobile-sdk-ios/blob/master/Example/AppleReminders/SceneDelegate.swift

So I kindly ask to remove it from the SceneDelegate.swift file (and do everything according to the documentation)

  1. >I try your screenshot, but failed:

Between first and second URLs I have coma, you put dot :)

but anyway, seems it's needed only crowdintest://

  1. Please, let me know whether you've added URL Scheme into Info.plist file: https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

If after removing callback from the config file and setting up URL Scheme inside info.plist file it won't work, I kindly ask you:

  • record short video with all steps to reproduce (it helps to investigate the root of the issue)
  • share your full SceneDelegate.swift file (I see screenshot, but I'm not sure whether it's full, sensitive data could be hidden, of course)
  • project URL

Thank you very much. It works!

denisqua commented 3 years ago

@weberlisper you're welcome as always!