# What is the Swift equivilent of getAccessTokenSilently

**URL:** <https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626>\
**Category:** Get Help\
**Tags:** nodejs, swift, ios\
**Created:** [June 21, 2022, 3:07pm UTC](https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626 "2022-06-21T15:07:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgleason](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jgleason/32/25904_2.png) [@jgleason](https://community.auth0.com/u/jgleason)\
**Post date:** [June 21, 2022, 3:07pm UTC](https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626/1 "2022-06-21T15:07:47Z")

</div>

I am currently authorizing specific APIs on my browser based application using `getAccessTokenSilently` from `@auth0/auth0-vue`. I don’t see any similar option for the Swift library. Is there a similar concept? How do I get access tokens for specific APIs or scopes? How do I manage these?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 22, 2022, 11:29pm UTC](https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626/3 "2022-06-22T23:29:38Z")

</div>

Hey @jgleason!

There isn’t an equivalent of `getAccessTokenSilently` just given the nature of mobile vs SPA:

> <https://github.com/auth0/Auth0.swift/issues/696>
>
> \<!--
> ❗ For general support or usage questions, use the Auth0 Community forums o…r raise a support ticket.
> 
> By submitting an issue to this repository, you agree to the terms within the Auth0 Code of Conduct: https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md.
> \--\>
> 
> \- \[x\] I have looked into the \[README\](https://github.com/auth0/Auth0.swift#readme) and have not found a suitable solution or answer
> \- \[x\] I have looked into the \[API documentation\](https://auth0.github.io/Auth0.swift/) and have not found a suitable solution or answer
> \- \[x\] I have searched the \[issues\](https://github.com/auth0/Auth0.swift/issues) and have not found a suitable solution or answer
> \- \[x\] I have searched the \[Auth0 Community\](https://community.auth0.com/tags/c/sdks/5/swift) forums and have not found a suitable solution or answer
> 
> \<!-- 
> ❗ All the above items are required. Issues with an incomplete or missing checklist will be unceremoniously closed.
> \--\>
> 
> \### 💥 Describe the problem you'd like to have solved
> 
> I have an iOS App that needs to access two different APIs, and each API has it's own audience. I want to be able to to ask for an access token with different audience without asking user for his password a second time.
> 
> \<!-- 
> A clear and concise description of what the problem is. For example, I'm always frustrated when...
> \--\>
> 
> \### ✨ Describe the ideal solution
> 
> Have the equivalent of \`getAccessTokenSilentrly\` of the Auth0 React SDK.
> 
> \<!-- 
> A clear and concise description of what you want to happen.
> \--\>
> 
> \### 🩹 Alternatives and current workarounds
> 
> The only workaround I found is by calling the login() function twice, with the same email, password but different audience.
> The issue with that is I can't use Auht0 Credentials manager anymore, I need to manage the login state and access tokens.
> 
> \<!-- 
> A clear and concise description of any alternatives you've considered or any workarounds that are currently in place.
> \--\>
> 
> \### 📌 Additional context
> 
> \<!-- 
> Add any other context or screenshots about the feature request here.
> \--\>

Have you had a chance to take a look at our Swift [quickstart](https://auth0.com/docs/quickstart/native/ios-swift/01-login)/[sample app](https://github.com/auth0-samples/auth0-ios-swift-sample/tree/master/Sample-01)? You’ll noticed that `WebAuth` is used for authentication - You can find the full reference documentation on it [here](https://auth0.github.io/Auth0.swift/Protocols/WebAuth.html#/s:5Auth07WebAuthP15connectionScopeyxSSF).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![jgleason](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jgleason/32/25904_2.png) [@jgleason](https://community.auth0.com/u/jgleason)\
**Post date:** [June 27, 2022, 2:57pm UTC](https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626/4 "2022-06-27T14:57:14Z")

</div>

I will take a look again at the sample app. So if I need multiple access tokens per audience and scope sets on the native how do I handle that?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 12, 2022, 2:58pm UTC](https://community.auth0.com/t/what-is-the-swift-equivilent-of-getaccesstokensilently/85626/5 "2022-07-12T14:58:08Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
