Skip to content

Instantly share code, notes, and snippets.

@seit
Last active December 20, 2022 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seit/8090463a376d4a11973e3a7c5011e74c to your computer and use it in GitHub Desktop.
Save seit/8090463a376d4a11973e3a7c5011e74c to your computer and use it in GitHub Desktop.
// エンドポイントを直接指定する場合
// val serviceConfig = AuthorizationServiceConfiguration(
// Uri.parse("https://www.example.com/app/v1/authorization"), // authorization endpoint
// Uri.parse("https://www.example.com/app/v1/token") // token endpoint
// )
// ディスカバリエンドポイントを利用する場合
AuthorizationServiceConfiguration.fetchFromIssuer(
Uri.parse("https://www.example.com/app/v1/"),
AuthorizationServiceConfiguration.RetrieveConfigurationCallback() {
authorizationServiceConfiguration: AuthorizationServiceConfiguration?, authorizationException: AuthorizationException? ->
_authState = authorizationServiceConfiguration?.let { AuthState(it) }
}
)
// ディスカバリエンドポイントを利用する場合(エンドポイントをフルパスで指定する)
AuthorizationServiceConfiguration.fetchFromUrl(
Uri.parse("https://www.example.com/app/v1/.well-known/openid-configuration"),
AuthorizationServiceConfiguration.RetrieveConfigurationCallback() { authorizationServiceConfiguration: AuthorizationServiceConfiguration?, authorizationException: AuthorizationException? ->
_authState = authorizationServiceConfiguration?.let { AuthState(it) }
}
)
_authService = AuthorizationService(requireContext())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment