User choice of Gaia hub now available during onboarding


@hank I know it doesn’t work for existing users. My point is, an app developer has to account for those users in their code or it fails. How do I account for these users? I can’t simply assume that everyone that encounters my app is going to create or use totally new identity.

I want to the app to prompt those creating a new id for a Hub URL. Users who have an existing identity should just pass through to the app — and it should, of course, use that users pre-existing hub URL just fine.


Ok. Chatted with @hank the solution was the position of the constant. Once I moved it to immediately before the redirectToSignInWithAuthRequest() the bam, it worked as I expected.

document.addEventListener("DOMContentLoaded", function(event) {

  document.getElementById('signin-button').addEventListener('click', function(event) {
    const authRequest = blockstack.makeAuthRequest(
      ['store_write', 'publish_data'],
      blockstack.nextHour().getTime(), {
        solicitGaiaHubUrl: true
      } // new options param
  document.getElementById('signout-button').addEventListener('click', function(event) {

  function showProfile(profile) {
    var person = new blockstack.Person(profile)
    document.getElementById('heading-name').innerHTML = ? : "Nameless Person"
    if(person.avatarUrl()) {
      document.getElementById('avatar-image').setAttribute('src', person.avatarUrl())
    document.getElementById('section-1').style.display = 'none'
    document.getElementById('section-2').style.display = 'block'

  if (blockstack.isUserSignedIn()) {
    var profile = blockstack.loadUserData().profile
  } else if (blockstack.isSignInPending()) {
    blockstack.handlePendingSignIn().then(function(userData) {
      window.location = window.location.origin