# Get tokens for users who don't exist

**URL:** <https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895>\
**Category:** Get Help\
**Tags:** passwordless\
**Created:** [March 5, 2020, 2:25am UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895 "2020-03-05T02:25:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dominic\_Bou-Samra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominic_bou-samra/32/7008_2.png) [@Dominic\_Bou-Samra](https://community.auth0.com/u/Dominic_Bou-Samra)\
**Post date:** [March 5, 2020, 2:25am UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/1 "2020-03-05T02:25:13Z")

</div>

Hi all.

About to start implementing a new feature whereby owners/managers of a resource, can enter a list of emails, and share that resource with them. These emails aren’t in our system at all, they are considered guest viewers of this resource (medical images in this case). They will have limited permissions, and only on that specific resource.

Does anyone have any suggestions or ideas that jump to mind?

Is any of Auth0’s Passwordless stuff useful here? I haven’t thought too far ahead, but maybe we email them a link, and when they open that link, it prompts them to enter their email. This then creates some sort of anonymous user within Auth0 with limited scope. I should say I require a token with certain scopes in order to use our API.

Edit: Doing some research and I think what I am looking for is something like: [Authenticate with Firebase Anonymously Using JavaScript](https://firebase.google.com/docs/auth/web/anonymous-auth)

Dom

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [March 5, 2020, 2:25pm UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/2 "2020-03-05T14:25:47Z")

</div>

Hi Dom,

Quick answer: yes I think this is doable, but it is fairly complex. This is one I would recommend Auth0 professional services for guidance:

> **[Auth0 Professional Services](https://auth0.com/docs/get-started/professional-services)**
>
> Describes the Auth0 professional services offerings.

It is not just a question of making a solution that solves the technical issues, but also doing so in a secure fashion. That makes this complex.

John

---

<div class="post-metadata">

**Author:** ![Dominic\_Bou-Samra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominic_bou-samra/32/7008_2.png) [@Dominic\_Bou-Samra](https://community.auth0.com/u/Dominic_Bou-Samra)\
**Post date:** [March 5, 2020, 11:33pm UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/3 "2020-03-05T23:33:07Z")

</div>

Are you able to provide a brief overview of the approach? I don’t necessarily want to engage professional services at this stage: it’s still a side project right now.

---

<div class="post-metadata">

**Author:** ![mathiasconradt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathiasconradt/32/12758_2.png) [@mathiasconradt](https://community.auth0.com/u/mathiasconradt)\
**Post date:** [March 6, 2020, 7:11am UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/4 "2020-03-06T07:11:48Z")

</div>

Is there a risk that users reshare links? In other words: do you need that specific user authentication, or would just a cryptic link (like Google Drive, Dropbox, Nextcloud, etc. does it) does it work general shareable links as well? (In the way that everybody who gets hold of the link would have access).

I believe, since it’s medical images, it’s critical data and you want this additional authentication layer in between, but just confirming, because this simple ‘cryptic’ link approach would of course be pretty easy to implement (without Auth0 even involved). Just checking that this is an option you’ve considered and already ruled out.

---

<div class="post-metadata">

**Author:** ![Dominic\_Bou-Samra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominic_bou-samra/32/7008_2.png) [@Dominic\_Bou-Samra](https://community.auth0.com/u/Dominic_Bou-Samra)\
**Post date:** [March 9, 2020, 12:52am UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/5 "2020-03-09T00:52:21Z")

</div>

> Is there a risk that users reshare links? In other words: do you need that specific user authentication, or would just a cryptic link (like Google Drive, Dropbox, Nextcloud, etc. does it) does it work general shareable links as well? (In the way that everybody who gets hold of the link would have access).

I think the cryptic approach is fine for now. Let’s explore this approach for now. What would it involve?

---

<div class="post-metadata">

**Author:** ![mathiasconradt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathiasconradt/32/12758_2.png) [@mathiasconradt](https://community.auth0.com/u/mathiasconradt)\
**Post date:** [March 9, 2020, 7:20am UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/6 "2020-03-09T07:20:03Z")

</div>

> I think the cryptic approach is fine for now. Let’s explore this approach for now. What would it involve?

Simply generate this random string, store it in a way in your backend linked to your document(s), then share it with the user in some way (i.e. email). As you can see in the example, it’s a generic path, where the backend then figured out based on the random string / stored mapping, which document to show.2  
In this scenario, there’s no involvement of the Auth0 platform needed.

 ![Screen Shot 2020-03-09 at 08.14.35](https://global.discourse-cdn.com/auth0/original/3X/6/5/652cfc899d31c31f2233b36f01a64ad81011264f.png)

---

<div class="post-metadata">

**Author:** ![Dominic\_Bou-Samra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominic_bou-samra/32/7008_2.png) [@Dominic\_Bou-Samra](https://community.auth0.com/u/Dominic_Bou-Samra)\
**Post date:** [March 9, 2020, 10:11pm UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/7 "2020-03-09T22:11:08Z")

</div>

> [@mathiasconradt](#):
>
> Simply generate this random string, store it in a way in your backend linked to your document(s), then share it with the user in some way (i.e. email). As you can see in the example, it’s a generic path, where the backend then figured out based on the random string / stored mapping, which document to show.2

Thanks so much for exploring this with me.

So this was the approach I initially considered. However, this won’t work without huge modification to our backend. We currently **require** a token when accessing the API. Ideally this token will come with limited scopes, and we can control auth easily that way.

Could we perhaps have a “[sharing@company.com](mailto:sharing@company.com)” user, and issue tokens from this fake user to the client from our backend server using the approach you described above? So the flow might look like this:

- User X shares resource A to User Y
- Backend processes share request and:
  - Creates entry in backend DB with the resource ID, who it’s shared to etc.
  - Get an access token for that fake user, with permissions set to something like “read:resource:A”
  - Send share email with access token embedded in query string to User Y’s email.

- User Y opens email, access token set in localStorage and proceeds.

Is that completely dodgy to:

- Send a token from the server in an email like that?
- Store token on local storage?

Thoughts?

---

<div class="post-metadata">

**Author:** ![deep.chakraborty](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@deep.chakraborty](https://community.auth0.com/u/deep.chakraborty)\
**Post date:** [April 25, 2024, 2:40pm UTC](https://community.auth0.com/t/get-tokens-for-users-who-dont-exist/38895/8 "2024-04-25T14:40:08Z")

</div>

Understand its an old post, did you get a solution to this @Dominic_Bou-Samra ?
