Hybris Mobile App SDK for iOS にログインできません。iOS SDK で Hybris が提供するデフォルトの B2B サンプル アプリケーションを使用しています。
マシンに Hybris プラットフォームをセットアップし、IP アドレス、ポート、およびユーザー名を Environments.plist ファイルに設定しました。B2B のデフォルトのユーザー名は mark.rivers@pronto-hw.com で、パスワードは 12341234 です。
以下はエラーです:
2016-09-07 18:19:45:445 yB2BApp[20152:70b] ログインボタンが押されました...
2016-09-07 18:19:47.197 yB2BApp[20152:291779] ユーザー mark.rivers@pronto-hw.com の初回トークンの取得
2016-09-07 18:19:47:198 yB2BApp[20152:70b] injectAuthorizationHeader 基本 bWFyay5yaXZlcnNAcHJvbnRvLWh3LmNvbToxMjM0MTIzNA==
2016-09-07 18:19:47:198 yB2BApp[20152:70b] URL https://:9002/authorizationserver/oauth/token 2016-09-07 18:19:47:198 yB2BApp[20152:70b] パラメータ
{
"client_id" = "mobile_android";
"client_secret" = secret;
"grant_type" = password;
password = 12341234;
username = "mark.rivers@pronto-hw.com";
}
2016-09-07 18:19:47:317 yB2BApp[20152:70b] トークンの取得中にエラーが発生しました: エラー ドメイン=com.alamofire.error.serialization.response コード=-1011 「要求が失敗しました: 無許可 (401)」 UserInfo=0x7b86e6e0
{com.alamofire.serialization.response.error.response= { URL: https://:9002/authorizationserver/oauth/token} { ステータス コード: 401、ヘッダー {
"Content-Type" = "application/json;charset=UTF-8";
Date = "Wed, 07 Sep 2016 12:49:47 GMT";
Server = "Apache-Coyote/1.1";
"Transfer-Encoding" = Identity;
"X-Frame-Options" = SAMEORIGIN;
} }, NSErrorFailingURLKey=https://:9002/authorizationserver/oauth/token, NSLocalizedDescription=Request failed: unauthorized (401), com.alamofire.serialization.response.error.data=<7b0d0a20 20202265 72726f72 7322203a 205b207b 0d0a2020 20202020 226d6573 73616765 22203a20 22556e6b 6e6f776e 20636c69 656e7420 6d6f6269 6c655f61 6e64726f 6964222c 0d0a2020 20202020 22747970 6522203a 2022556e 61757468 6f72697a 65644572 726f7222 0d0a2020 207d205d 0d0a7d>}
2016-09-07 18:19:47:318 yB2BApp[20152:70b] 認証トークンの取得中の問題、理由: 要求が失敗しました: 承認されていません (401)
2016-09-07 18:19:47:630 yB2BApp[20152:70b] エラーが取得されました...
また、コードには、authorizationHeader を追加する applyBasicAuth メソッドがあり、BASIC_AUTH は代わりにパスワードに基づいて一定です。これは変更されるはずですか:
- (void)applyBasicAuth {
if(self.restEngine) {
NSString *authorizationHeader = [NSString stringWithFormat:@"Basic %@", BASIC_AUTH];
[self.restEngine injectAuthorizationHeader:authorizationHeader];
} else {
DDLogError(@"!!! RestEngine not set !!!");
}
}
BASIC_AUTH は次のとおりです。
#define BASIC_AUTH @"bW9iaWxlX2FuZHJvaWQ6c2VjcmV0"
Environments.plist スクリーンショット:
エラーのスクリーンショット:
郵便配達員の結果:
Hybris コンソール ログ:
エラー [hybrisHTTP20] [xx.xxx.xx.xxx] [ClientCredentialsTokenEndpointFilter] ユーザーの認証中に内部エラーが発生しました。org.springframework.security.authentication.InternalAuthenticationServiceException: 不明なクライアント mobile_ios at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:110) ~[spring-security-core-3.2.5.RELEASE.jar: 3.2.5.RELEASE] at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:132) ~[spring-security-core-3.2.5.RELEASE.jar: at org.springframework.security. authentication.ProviderManager.authenticate(ProviderManager.java:156) ~[spring-security-core-3.2.5.RELEASE.jar:3.2.5.RELEASE] at org.springframework.security.