# User not assigned is not reprompted to reauthenitcate on log out

**URL:** <https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048>\
**Category:** Questions\
**Created:** [December 8, 2020, 3:08am UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048 "2020-12-08T03:08:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaia](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gaia](https://devforum.okta.com/u/gaia)\
**Post date:** [December 8, 2020, 3:08am UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/1 "2020-12-08T03:08:44Z")

</div>

I am trying to implement OIDC in a Phoenix (Elixir) backend app. Everything works well, until I have a user who is not assigned to the app. When this happens and I go to the authorization path, the user is not reprompted to login. The user just receives the same error again (“User is not assigned to the client application.”)

My app is structured in a way where if no user is logged in, they get redirected to the authentication page, so in this case I have an infinite loop where I constantly get the “User not assigned” error.

I would like to have something like the OIDC `/logout` endpoint but I need an `id_token` for this and I don’t have it because the user has the access denied.

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [December 8, 2020, 12:32pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/2 "2020-12-08T12:32:30Z")

</div>

you should have a “callback” page, which analyzes respond from Okta, and if token is received then only let them in

---

<div class="post-metadata">

**Author:** ![gaia](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gaia](https://devforum.okta.com/u/gaia)\
**Post date:** [December 8, 2020, 2:26pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/3 "2020-12-08T14:26:00Z")

</div>

I do have a callback page. If I don’t receive a token it redirects to the authorization page again. But I don’t get reprompted with the credentials on okta side, as the session is not forgotten. I need a way to delete okta session. This is why it keeps looping.

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://devforum.okta.com/u/warren)\
**Post date:** [December 8, 2020, 6:58pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/4 "2020-12-08T18:58:03Z")

</div>

You can delete the current Okta session using the /sessions/me endpoint

> **[Sessions | Okta Developer](https://developer.okta.com/docs/reference/api/sessions/#close-current-session)**

---

<div class="post-metadata">

**Author:** ![gaia](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gaia](https://devforum.okta.com/u/gaia)\
**Post date:** [December 8, 2020, 8:43pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/5 "2020-12-08T20:43:10Z")

</div>

I have tried that but I keep receiving a 404.

```auto
{
    "errorCode": "E0000007",
    "errorSummary": "Not found: Resource not found: me (Session)",
    "errorLink": "E0000007",
    "errorId": <error_id>,
    "errorCauses": []
}

```

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://devforum.okta.com/u/warren)\
**Post date:** [December 8, 2020, 8:56pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/6 "2020-12-08T20:56:54Z")

</div>

Are you able to make the request from the browser side/frontend? Also, might need to set `withCredentials` to true.

> **[XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)**
>
> The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting withCredentials has...

---

<div class="post-metadata">

**Author:** ![gaia](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gaia](https://devforum.okta.com/u/gaia)\
**Post date:** [December 8, 2020, 8:59pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/7 "2020-12-08T20:59:02Z")

</div>

I am only able to make the requests backend side.

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://devforum.okta.com/u/warren)\
**Post date:** [December 8, 2020, 10:23pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/8 "2020-12-08T22:23:50Z")

</div>

Then I agree with phi1ipp that you probably want to add some validation on the `/callback` page to check if there are any errors in the response url.

You can also try redirecting `https://yourOrg.okta.com/login/signout` to see if that will log the user out of Okta.

---

<div class="post-metadata">

**Author:** ![gaia](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gaia](https://devforum.okta.com/u/gaia)\
**Post date:** [December 8, 2020, 10:31pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/9 "2020-12-08T22:31:20Z")

</div>

I do have validation in the /callback page. If an error is returned (in this case `access_denied`), then I redirect the user to the login page. But because there is an active session, the user is not prompted to input their credentials again, instead the error `access_denied` is returned again, thus creating an infinite redirection loop between the callback page and the Okta authentication page.

---

<div class="post-metadata">

**Author:** ![ryan.stewart](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/ryan.stewart/32/2442_2.png) [@ryan.stewart](https://devforum.okta.com/u/ryan.stewart)\
**Post date:** [December 11, 2020, 8:02pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/10 "2020-12-11T20:02:09Z")

</div>

Hi Warren, If a user is not assigned to the application I don’t understand why you would want to redirect them to the login page. Even if they log in again, that will only result in the same “User is not assigned to the client application” result. You’ll end up at the same place with the additional step of logging in again.

It seems to me that if the user is not assigned to the app in Okta you need to handle that differently than an unauthenticated user and direct the user to some place where they can request access to the app, or simply display a message that they are not allowed to use the app, with options to open a support ticket or leave if they are not supposed to be there.

If all users should have access to the app then I think you need to figure out why the user is not assigned to the app and fix that.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 25, 2024, 11:44pm UTC](https://devforum.okta.com/t/user-not-assigned-is-not-reprompted-to-reauthenitcate-on-log-out/12048/11 "2024-01-25T23:44:27Z")

</div>

Closed on January 25, 2024, 11:44pm UTC


