Comments (10)
Hi @SanjoDeundiak I suggest you work through the QuickStart guide to get started.
https://auth0.com/docs/quickstart/native/ios-swift/getting-started
from auth0.swift.
@cocojoe I've seen this guide, and I'm using it from Dashboard where I was able to download finished example with my API details already filled.
from auth0.swift.
Downloading it is one thing, but it's worth reading through as there are also manual steps such as setting up your callback. Generally if it doesn't work it's a case of double checking all of the steps.
from auth0.swift.
@cocojoe I've checked the tutorial. callback is setup correctly, otherwise I would see HTML with description that I should add this callback to the list of allowed callbacks (which I did). I hope that my error does really mean something and you can point where mistake can align more precisely than just "Check tutorial one more time"
from auth0.swift.
Access Denied
infers the resource owner has denied access, so double checking setup is a good first sanity check, if you may have multiple clients it's worth checking that Auth0.plist
has the credentials you expect.
If you have done this then I would add some logging so you can see what calls are being made that would aid in understanding what is happening with the client<>server API flow.
https://github.com/auth0/auth0.swift#logging
Also please supply the code you are using to produce this error. So I can reproduce it.
Thanks
from auth0.swift.
@cocojoe Credentials do match. Source code is pretty much the same as one in the sample.
@IBAction func showLoginController(_ sender: UIButton) {
guard let clientInfo = plistValues(bundle: Bundle.main) else { return }
var auth = Auth0.webAuth()
auth
.logging(enabled: true)
.scope("openid profile")
.audience("https://" + clientInfo.domain + "/userinfo")
.start {
switch $0 {
case .failure(let error):
print("Error: \(error)")
case .success(let credentials):
guard let accessToken = credentials.accessToken else { return }
self.showSuccessAlert(accessToken)
}
}
}
Here are log messages for sign-up + sign in
2018-01-09 20:03:58.375563+0200 Auth0Sample[4957:396599] Simulator user has requested new graphics quality: 10
Safari: https://sanjo.eu.auth0.com/authorize?state=zLLQME1wz-p6dqFjcA-OJYhnt_hKrlTZep8xIxEAiIE&response_type=code&redirect_uri=auth0.samples.Auth0Sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback&client_id=ZQxpWut8dTXdHCNvBm9OvOZ32kEPLCW0&audience=https://sanjo.eu.auth0.com/userinfo&code_challenge=dN0JxWL8HFcTctjZAmjO-aHU_IYpWmTDbN3-LE2jTME&code_challenge_method=S256&scope=openid%20profile&auth0Client=eyJuYW1lIjoiQXV0aDAuc3dpZnQiLCJ2ZXJzaW9uIjoiMS44LjAiLCJzd2lmdC12ZXJzaW9uIjoiMy4wIn0
2018-01-09 20:04:03.201399+0200 Auth0Sample[4957:396599] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/sanjo/Library/Developer/CoreSimulator/Devices/0BA302D1-73E6-4A3D-846D-53E853DA2DDE/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-01-09 20:04:03.202301+0200 Auth0Sample[4957:396599] [MC] Reading from private effective user settings.
2018-01-09 20:04:03.240841+0200 Auth0Sample[4957:396599] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-01-09 20:04:18.133186+0200 Auth0Sample[4957:396599] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
iOS Safari: auth0.samples.auth0sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback?error=unauthorized&error_description=Access%20denied.&state=zLLQME1wz-p6dqFjcA-OJYhnt_hKrlTZep8xIxEAiIE
Error: Access denied.
Safari: https://sanjo.eu.auth0.com/authorize?state=5fpqgpuQmX1r6qNG-oSYVUoycmjxotroBw9FP_IYyOw&response_type=code&redirect_uri=auth0.samples.Auth0Sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback&client_id=ZQxpWut8dTXdHCNvBm9OvOZ32kEPLCW0&audience=https://sanjo.eu.auth0.com/userinfo&code_challenge=DZ-jTmoPqWH38O3mI6WpnkUeLiiojFTd3x05HgjibYw&code_challenge_method=S256&scope=openid%20profile&auth0Client=eyJuYW1lIjoiQXV0aDAuc3dpZnQiLCJ2ZXJzaW9uIjoiMS44LjAiLCJzd2lmdC12ZXJzaW9uIjoiMy4wIn0
2018-01-09 20:04:22.198381+0200 Auth0Sample[4957:396599] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-01-09 20:04:22.198733+0200 Auth0Sample[4957:396599] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-01-09 20:04:28.102352+0200 Auth0Sample[4957:396599] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
iOS Safari: auth0.samples.auth0sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback?error=unauthorized&error_description=Access%20denied.&state=5fpqgpuQmX1r6qNG-oSYVUoycmjxotroBw9FP_IYyOw
Error: Access denied.
from auth0.swift.
Thanks, so a simple way to sanity check is to copy the authorize
url into a browser. Doing this I get:
Callback URL mismatch.
The url "auth0.samples.Auth0Sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback" is not in the list of allowed callback URLs: auth0.samples.auth0sample://sanjo.eu.auth0.com/ios/auth0.samples.auth0sample/callback.
The callback URL is case sensitive so you need to update the Callback to use auth0.samples.Auth0Sample://sanjo.eu.auth0.com/ios/auth0.samples.Auth0Sample/callback
in the Auth0 Dashboard and it should work.
from auth0.swift.
@cocojoe I changed it while digging around to find the issue. Now I've reverted allowed callbacks and get the same "Access denied" error
from auth0.swift.
@SanjoDeundiak I am wondering if there is something else going on that has not been mentioned, have you been trying out Rules in the dashboard?
If you have please disable them and re-test.
from auth0.swift.
@cocojoe yes, that was the case. It turned out that creating default whitelist rule will block nearly all emails from sign up/sign in. Thank you for your help)
P.S. Adding some warning to this page for people like me, who digs everywhere to check out what service can do, would be great.
from auth0.swift.
Related Issues (20)
- Support configuring endpoint HOT 2
- Swift Cannot read properties of undefined (reading ‘passwordless_method’) HOT 1
- AQA testing cannot access web context on web auth with auth0. HOT 3
- CI build error due to recent Package.swift update HOT 13
- Versions prior to 2.4.0 (namely the previous one 2.3.2) are not compatible with iOS 12 anymore HOT 2
- Crash with numeric bundle indentifier HOT 1
- The .start method callback is sometimes not called HOT 5
- The callback execution thread is not consistent HOT 4
- Auth0 not working in iOS 17. Not able to login HOT 8
- In v2 we can no longer build out our own token request HOT 9
- Login with OTP with custom realm HOT 1
- Custom minTTL support with renew() API HOT 2
- Passwordless authentication does not accept additional parameters HOT 2
- Privacy Manfiest HOT 4
- SWIFT TASK CONTINUATION MISUSE: clearSession(federated:) leaked its continuation! HOT 2
- Auth0 does not support visionOS
- Missing AuthenticationError helper for Revoked tokens
- Auth0 does not support Social Logins for visionOS HOT 1
- isNetworkError does not report case where Wifi + Mobile Data is off HOT 1
- Auth0.webAuth() doesn't work during migration from iOS to VisionOS platform HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth0.swift.