私はidentityServer3を使用してIDサーバーをセットアップしました。今、アイデンティティサーバーに対して認証するためのiOSアプリケーションを作成しています。私はこの設定のための例やコードを見つけることができませんでした。私が見つけた例は、すべてgoogleやgithubなどを使用しています。私の問題は、OAuthSwift.authorizeWithCallbackURL
という呼び出しが画面をSafariに切り替えるだけで何も表示されないということです。私はcallbackurlまたはURLスキームの私のセットアップが正しくないと思われる。ここでOAuthSwiftとidentityserver3を使用する場合に必要なサンプルコード
は私のコードスニペットは、サーバ側で
です:のiOSアプリ側の
new Client {
ClientId = "implicitclient1",
ClientName = "Example Implicit Client1",
ClientSecrets = new List<Secret>
{
new Secret("secret".Sha256())
},
Enabled = true,
Flow = Flows.Implicit,
RequireConsent = true,
AllowRememberConsent = true,
RedirectUris =
new List<string> {"oauth-swift://oauth-callback/TestOAuth2"},
AllowedScopes = new List<string> {
Constants.StandardScopes.OpenId,
Constants.StandardScopes.Profile,
Constants.StandardScopes.Email
},
AccessTokenType = AccessTokenType.Jwt
},
:
let oauthswift = OAuth2Swift(
consumerKey: "implicitclient1",
consumerSecret: "secret",
authorizeUrl: "https://example.com/idserver/core/connect/authorize",
accessTokenUrl: "https://example.com/idserver/core/connect/token",
responseType: "token"
)
oauthswift.authorizeWithCallbackURL(NSURL(string: "oauth-swift://oauth-callback/TestOAuth2")!,
scope: "openid",state: "",
success: {
credential, response, parameters in
print(credential.oauth_token)},
failure: {
error in
print(error.localizedDescription)
})
私は、iOSアプリへのURLのタイプを追加する場合"TestOAuth2"を入れてください。
どうしたのですか?
ありがとうございます。