• RE: Access google calendars of multiple google accounts (with user permission)

    Sure!

    This is a case of Third-Party Service Authorization where your application is trying to access data on behalf of users held by another party (Google in this case).

    This will require some integration work on your part, but the basic steps are:

    • Integrate your application with FusionAuth (our quickstarts are a good place to start). Make sure you check the 'keep me signed in' value set, using a hidden field.
    • Set up an Identity Provider. You don't want to use the Google Identity Provider because it doesn't support the prompt URL parameter.
      • Use the OIDC Identity Provider with the prompt parameter set to select_account to let the users pick different accounts, and make sure you set access_type to offline to get a refresh token. More here.
      • Set the Linking strategy to Pending.
      • You'll also need to set up your Google scopes correctly. Based on your question, you'll want to use https://www.googleapis.com/auth/calendar.events.readonly as an additional scope.
      • You'll want to follow the Google Identity Provider instructions insofar as they pertain to navigating the Google Cloud Console.
    • Create an 'connect your account with google' button in your application. This should point to the OIDC Identity Provider. You can use an idp_hint to send the user directly to Google when they click it.
    • After they return from google, having selected their account, they should be logged in to your application. (It's possible with Pending they'll be prompted to login to your application again, but I don't think so. Would have to test.) They'll also have a link that is accessible via the Link API. That link will contain the refresh token in the token field.
      • You can also iterate all the links in your application using one of our client libraries to display to the user which google accounts they have connected.

    Now you have connected 1 or more Google accounts to a FusionAuth account.

    Next, when you want to retrieve calendar events for your application to process, take these steps:

    • Call the Links API for the user to retrieve all the links
    • Retrieve the Google refresh token from the token field
    • Get a fresh access token using the Refresh grant
    • Use the access token to retrieve the event data using either the API or a Google SDK.
    • ... profit!

    If the refresh token has expired (you don't get back a valid access token), inform the user and have them go through the authorization process again.

    Hope this helps.

    posted in Q&A
  • Access google calendars of multiple google accounts (with user permission)

    Hiya,

    We have a situation where we have users. Each user has 1 or more Google accounts. We want to be able to read events from a calendar using Google APIs.

    Is this something that FusionAuth can help with?

    posted in Q&A google calendar api access
  • RE: Is it possible to join user account from email / google login

    FusionAuth provides a feature called Identity Provider (IdP) Linking Strategies that allows you to link social login accounts to existing FusionAuth accounts. This feature is available since version 1.28.0.

    There are several strategies you can use to link accounts:

    1. Link On Email: This strategy will create a new user if they don’t exist. However, if the user has an email address at their social provider which differs from the email address that was used to sign up for your application and which you imported to FusionAuth, then two accounts will be created.

    2. Link On Username: Similar to the Link On Email strategy, this will also create a new user if they don’t exist. But it has a greater risk of account takeover and should be used with caution. In most cases, you would never want to enable more than one identity provider to link by username because there could be a username collision.

    3. Pending: This strategy will prompt the end user to sign into FusionAuth after they sign into the social provider, authoritatively linking the two accounts.

    To implement this, you'd have to get the user to login via their social account and get their unique user Id. Then you'd take that user Id and create a link using the APIs. After the link is created, the next time the user went to login, they could use either their old email/password credentials or the linked social login.

    Here's more information about IdP Linking Strategies.

    Sources:

    posted in Q&A
  • RE: "Confirmation required" screen not appearing where expected

    @justin-calareso to test this screen, you can always select preview on your theme to see if it would work if needed.

    4d96f8f3-c0b9-4b8e-9757-f2f04bc7bf98-image.png

    Then select the "Confirmation required" screen. Notice how I put "Alex did this" on this confirmation.

    8c4d814b-c294-4ff9-9611-e6cecca06dfe-image.png

    One of the easiest ways to try this out is to use Passwordless login. As you can see in the Theme I have the confirmation page example set which I added <h1>Confirmation page example</h1>
    d32abe10-15cd-49ec-b4aa-0678fd54be20-image.png

    Now when I log in to the application I am presented with the option for "Login with magic link"

    35733ee4-3266-482c-8374-97542a0bf196-image.png

    This will email me a link which I can open in a new private window (or different browser not already logged into the application).
    6180b8f8-24a6-4e64-9db2-124de8b07749-image.png

    Once I open this in the new window you will see that the confirmation required has my H1 tag showing "Confirmation page example".

    c7352f4a-c0ba-4549-a239-6a64ef669bc8-image.png

    I hope this helps.

    posted in Q&A
  • RE: Is it possible to limit the number of devices a user can login with?

    This might be useful for visitors in the future: https://fusionauth.io/docs/extend/examples/device-limiting

    posted in Q&A
  • RE: how to implement user invitation

    Hiya @kasir-barati ,

    You can certainly use just a subset of known invite codes. In that case, no need to store the codes on the user.

    Instead, add an array of codes in the self-service registration lambda and have a step check to see that the user provided code value matches one of the known values in the array.

    posted in Q&A
  • RE: how to implement user invitation

    This isn't out of the box, but is relatively easy to implement.

    • After each user is added successfully, create a list of codes in their user.data.inviteCodes field (which can be an array). It's a good idea to have the codes be alphanumeric because FusionAuth's elastic search indexing handles those types of values best. Let's call this user the inviter user. Make sure each code is unique across all users.
    • When a user tries to register with a code, let's call that user the invitee user.
    • Build a page in your application to display the list of user.data.inviteCodes to prospective inviters.
    • Create a custom registration form and have one of the fields be an invite code, to be provided by the invitee user (because they got it from the inviter user).
      • You could prepopulate this via a link by customizing the theme and having javascript pull the value from a query parameter and put it into the form.
    • Create a self-service registration validation lambda.
    • In that lambda, search for the code.
    • If it is not found, add an error. This error will prevent the user from registering.
    • If it is found, take the following steps:
      • Allow the registration to succeed.
      • Add a webhook to listen for the create user event, which reads the invitation code.
      • From the webhook, update the inviter user to remove the used code from the user.data.inviteCodes, which means that code can't be used by future invitees.
      • That same webhook can update the invitee's user.data.inviteCodes field so that they can now become inviters (or maybe that happens later, depending on business logic).

    If invitees use the same code within time period the elasticsearch index is updated (usually 1 second), there may be a race condition that would allow two invitees to register with the same code.

    If absolute isolation in the invite code processing is important, use Lambda HTTP connect in the self-service registration validation lambda to check if a code is valid, and have that read from an RDBMS.

    In this case, you'll need to provide the code and the inviter email address in the form so the lambda can provide it to the API. These fields can both be hidden.

    You can also consider adding an expiry timestamp to the user.data.inviteCodes if that functionality is needed.

    Here's an example of the user.data.inviteCodes value:

    "inviteCodes" : [
     { 
       "invcode": "abc123",
       "exp":  1712679467
     },
     {
       "invcode": "234jklasdf",
       "exp":  183678467
     }
    ]
    

    And here's an example of a queryString that will pull the user with the abc123 invite code, or return zero records if that is not found.

    data.inviteCodes.invcode:abc123
    

    Read more about elasticsearch arrays.

    posted in Q&A
  • how to implement user invitation

    I have an application that I want to invite users to and want users to be able to invite users to. I do not want to allow users to register for this application without being invited.

    I've seen: https://fusionauth.io/community/forum/topic/935/how-to-implement-user-invitation but was wondering what the current best practice is.

    posted in Q&A
  • RE: Robots.txt file at FusionAuth root location?

    @ronn316 Hey - the easiest way to prevent indexing on any pages you don't want indexed is to add a meta tag to the templates. Something that looks like this -> <meta name="robots" content="noindex">

    Cheers,
    Tony

    posted in Q&A
  • RE: Random Unavailability of Dedicated FusionAuth Instance from GKE (Impacts Site Availability)

    @jacob-0 Sorry to hear you are having issues. Thank you for the detailed post explaining it. Unfortunately, random unavailability can be very difficult to troubleshoot.

    Based on your explanation, it seems as though the instance is available from outside the GKE cluster. Could this be an issue with one of the pods going down and being restarted and the internal networking not recognizing the change? I don't quite see how it would still work from the outside, but is there any evidence of pods restarting around the down time?

    posted in General Discussion