Hey guys,
My website is currently only accessible by login in through Auth0 but I want to make a single page accessible without authentication, a way for anyone to type in a specific URL and not have to log in. How can I do this?
Thanks
Hey guys,
My website is currently only accessible by login in through Auth0 but I want to make a single page accessible without authentication, a way for anyone to type in a specific URL and not have to log in. How can I do this?
Thanks
You need to provide more information for anyone to be able to help you.
Please refer to the Quickstart: https://auth0.com/docs/quickstart/spa/angularjs/04-authorization#protect-client-side-routes
To protect a route, you define a function to check authentication, then call this onEnter
. To leave a route unprotected, simply don’t call this in the onEnter
hook:
$stateProvider
// ...
.state('ping', {
url: '/ping',
controller: 'PingController',
templateUrl: 'app/ping/ping.html',
controllerAs: 'vm',
onEnter: checkAuthentication // This protects the route. Simply don't call this to leave it unprotected.
})
// ...
function checkAuthentication($transition$) {
var $state = $transition$.router.stateService;
var auth = $transition$.injector().get('authService');
if (!auth.isAuthenticated()) {
return $state.target('home');
}
}