Software Development

How to Determine User Sign-In Location

Okta Workflows how-to guides are questions and answers from weekly community office hours, MacAdmins Workflows Slack channel, and other places. Read all other how-to guides

On to the question. 

How to determine user sign-in location information?

This how-to is based on WorkflowsTip #8, from Ashwin Ramnarayanan, Solutions Engineer at Okta.

Determining location

When you use the Okta – User Sign In Attempt event card, the event has information about user’s geolocation.

Using User Sign In Attempt event card

The Event Details JSON section has information that also includes the geolocation information.

To retrieve the location information, use the Get Multiple card with the client.geographicalContext path.

For example, if a user signs in from San Diego, the JSON might look like this:

  "city": "San Diego",
  "state": "California",
  "country": "United States",
  "postalCode": "92014",
  "geolocation": {
    "lat": 32.7157,
    "lon": -117.1610

The other path in the Get Multiple card, the client.outcome, holds information on whether the sign-in was successful or not.

JSOM from a failed sign-in:

  "result": "FAILURE",

JSON from a successful sign-in:


Next, you are going to see how to build a flow that sends a notification when a user signs in from a particular country.

Sending a sign-in notification

In this section, you are going to update the flow to get a notification when a sign-in happens from a specific country.

When a user signs in from a country in the Workflows table (shown below), you want to get notified.

Country list

The flow looks like this:

A flow to notify when a sign-in happens from a country

The flow has the following cards:

  • The User Sign In Attempt event cards fires when a user attempts a sign-in
  • The Get Multiple card retrieves country and sign-in outcome information. The card is updated to retrieve the country name and sign-in outcome directly (in the first section, you retrieved the JSON). Paths to retrieve the exact values:
    • outcome.result
  • The Search Rows card searches if a country from which a sign-in happened matches a country listed in the table

  • The first Continue If card checks if a country was matched. If yes, the flow continues
  • The second Continue If cards checks if a sign-in was successful. If yes, the flow continues
  • The Compose card creates a message with sign-in information. You can send the message to Slack, email or SMS

What you learned

You learned how to determine a sign-in location information. You also learned how to build a flow that allows to send a notification when a sign-in happens from a particular country.

Published on Java Code Geeks with permission by Max Katz , partner at our JCG program. See the original article here: How to Determine User Sign-In Location

Opinions expressed by Java Code Geeks contributors are their own.

Want to know how to develop your skillset to become a Java Rockstar?

Join our newsletter to start rocking!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button