-
Notifications
You must be signed in to change notification settings - Fork 35
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
[Patch] Revoke OAuth tokens at sample start #239
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,16 +23,24 @@ import androidx.compose.material3.MaterialTheme | |||||||||||||||||||||||||||||
import androidx.compose.material3.Surface | ||||||||||||||||||||||||||||||
import androidx.compose.runtime.Composable | ||||||||||||||||||||||||||||||
import androidx.lifecycle.viewmodel.compose.viewModel | ||||||||||||||||||||||||||||||
import com.arcgismaps.ArcGISEnvironment | ||||||||||||||||||||||||||||||
import com.arcgismaps.toolkit.authentication.DialogAuthenticator | ||||||||||||||||||||||||||||||
import com.arcgismaps.toolkit.authentication.signOut | ||||||||||||||||||||||||||||||
import com.esri.arcgismaps.sample.authenticatewithoauth.components.MapViewModel | ||||||||||||||||||||||||||||||
import com.esri.arcgismaps.sample.authenticatewithoauth.screens.MainScreen | ||||||||||||||||||||||||||||||
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme | ||||||||||||||||||||||||||||||
import kotlinx.coroutines.runBlocking | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
class MainActivity : ComponentActivity() { | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
override fun onCreate(savedInstanceState: Bundle?) { | ||||||||||||||||||||||||||||||
super.onCreate(savedInstanceState) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
// Sign out of any portals which are already authenticated | ||||||||||||||||||||||||||||||
runBlocking { | ||||||||||||||||||||||||||||||
ArcGISEnvironment.authenticationManager.signOut() | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not recommended to use
Suggested change
Same change would need to be made to Show Portal User Info & Create And Save Map samples. |
||||||||||||||||||||||||||||||
setContent { | ||||||||||||||||||||||||||||||
SampleAppTheme { | ||||||||||||||||||||||||||||||
AuthenticateWithOAuthApp() | ||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,10 @@ import androidx.compose.material3.Surface | |
import androidx.compose.runtime.Composable | ||
import com.arcgismaps.ApiKey | ||
import com.arcgismaps.ArcGISEnvironment | ||
import com.arcgismaps.toolkit.authentication.signOut | ||
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme | ||
import com.esri.arcgismaps.sample.showportaluserinfo.screens.MainScreen | ||
import kotlinx.coroutines.runBlocking | ||
|
||
class MainActivity : ComponentActivity() { | ||
|
||
|
@@ -35,6 +37,11 @@ class MainActivity : ComponentActivity() { | |
// required to access basemaps and other location services | ||
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.API_KEY) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be setting an API key here, since the sample uses a named user? \cc @shubham7109 |
||
|
||
// Sign out of any portals which are already authenticated | ||
runBlocking { | ||
ArcGISEnvironment.authenticationManager.signOut() | ||
} | ||
|
||
setContent { | ||
SampleAppTheme { | ||
ShowPortalUserInfoApp() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the API key also be nulled out here, same as you did in Create And Safe Map sample?