Skip to content

Commit 8b09421

Browse files
committed
update to latest sdk
1 parent 5ebe404 commit 8b09421

File tree

10 files changed

+47
-49
lines changed

10 files changed

+47
-49
lines changed

app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ nconf
2323
'DOMAIN_URL_SDK': 'login-dev.auth0.com:3000',
2424
'DOMAIN_URL_DOCS': 'https://localhost:5050',
2525
'WIDGET_FALLBACK_CLIENTID': 'aCbTAJNi5HbsjPJtRpSP6BIoLPOrSj2C',
26-
'LOGIN_WIDGET_URL': 'https://cdn.auth0.com/w2/auth0-widget-2.4.min.js',
27-
'AUTH0JS_URL': 'https://cdn.auth0.com/w2/auth0-1.2.2.min.js',
26+
'LOGIN_WIDGET_URL': 'https://cdn.auth0.com/w2/auth0-widget-2.6.min.js',
27+
'AUTH0JS_URL': 'https://cdn.auth0.com/w2/auth0-1.6.4.min.js',
2828
'SENSITIVE_DATA_ENCRYPTION_KEY': '0123456789',
2929
'PUBLIC_ALLOWED_TUTORIALS': '/adldap-auth?,/adldap-x?,/adfs?',
3030
});

docs/custom-signup.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ $('#create-user').submit(function (event) {
6565
'username': userData.email,
6666
'password': userData.password,
6767
'connection': 'Username-Password-Authentication'
68+
}, function (err, profile, id_token, access_token) {
69+
// store the profile in localstorage/cookie
6870
});
6971
},
7072
error: function () {
@@ -95,13 +97,3 @@ After receiving the request from the client, the JSON contained in the body of t
9597

9698
> Bear in mind that before doing that you may need to generate an access token. Check the API section for more information.
9799
> In case you are using any of our bindings for Node.js, ASP.NET you may use those instead of doing the HTTP requests manually.
98-
99-
### 5. Add the necessary code to show the profile when logged in:
100-
101-
```js
102-
widget.parseHash(window.location.hash, function (profile, id_token, access_token, state) {
103-
$('#user-profile .email').text(profile.email);
104-
$('#user-profile .color').text(profile.color);
105-
$('#user-profile .food').text(profile.food);
106-
});
107-
```

docs/includes/callapi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ You have two options: (a) use the same client id and secret for both your applic
77

88
### <i class="icon icon-html5" style="margin-right: 10px;font-size: 25px;"></i> Single Page Applications / HTML5 JavaScript Front End
99

10-
The `JWT` is available on the location hash of the browser as the `id_token` parameter. You probably want to store it in local/session storage or a cookie `auth0.parseHash(window.location.hash, ...)`. <a href="singlepageapp-tutorial" target="_new">Read more...</a>
10+
The `JWT` is available on the location hash of the browser as the `id_token` parameter. You probably want to store it in local/session storage or a cookie `auth0.getProfile(window.location.hash, ...)`. <a href="singlepageapp-tutorial" target="_new">Read more...</a>
1111

1212
### <i class="icon icon-mobile-phone" style="margin-right: 10px;font-size: 30px;"></i> Native Mobile Applications
1313

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The introductory tutorials will take a just a few minutes to complete. And the g
2929
</div>
3030

3131
<div class="col-sm-2 ">
32-
<a href="/aspnet-tutorial" class="logo-tutorial">
32+
<a href="/aspnet-owin-tutorial" class="logo-tutorial">
3333
<strong><img src="https://auth0.com/developers/img/logos/platforms/asp.png"></strong>
3434
<span>ASP.NET Owin</span>
3535
</a>

docs/login-widget2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You can handle the authorization process client-side as follows:
2929
callbackOnLocationHash: true
3030
});
3131

32-
widget.parseHash(window.location.hash, function (profile, id_token, access_token, state) {
32+
widget.getProfile(window.location.hash, function (err, profile, id_token, access_token, state) {
3333
alert('hello ' + profile.name);
3434
// use id_token to call your rest api
3535
});
@@ -53,6 +53,7 @@ The Widget can be customized through the `options` parameter sent to the `signin
5353
* __showIcon__: Show/Hide widget icon. Default: false.
5454
* __showForgot__: Show/Hide the "Forgot your password?" link. Default: true.
5555
* __showSignup__: Show/Hide the "Sign Up" link. Default: true.
56+
* __enableReturnUserExperience__: Show the account used last time the user signed in. Default: `true`.
5657
* __userPwdConnectionName__: Specify which Database/AD-LDAP connection should be used with the Email/Password fields. Default: the first Database connection found (if it exists) or the first AD-LDAP connection found.
5758
* __username_style__: Specify the format of the username. Options: `email` or `username`.
5859

docs/singlepageapp-tutorial.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
@@sdk2WithCallbackOnHash@@
1414

15-
> Ignore the `callbackOnLocationHash` option and the `widget.parseHash` method if you are using the <a target="_new" href="https://github.com/auth0/auth0-aspnet-owin">Auth0-ASPNET-Owin</a> nuget package (use `@ClaimsPrincipal.Current.FindFirst("id_token").Value` instead).
16-
1715
### 3. Validate the JsonWebToken on the server
1816

1917
Auth0 returns a standard [JSON Web Token](http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-12) in the browser location hash (http://yourapp#id_token=...). This token should be sent to the backend APIs to be validated in the `Authorization` header.
@@ -31,12 +29,4 @@ This sample code sends the JSON Web Token on each call:
3129

3230
> Setting the cookie on the client-side using this method requires [jQuery.Cookie](https://github.com/carhartl/jquery-cookie).
3331
34-
To validate the token on the server side, we have tutorials for several platforms and languages to get you up and running as quickly as possible:
35-
36-
* [ASP.NET Web API](aspnetwebapi-tutorial)
37-
* [Node.js API](nodeapi-tutorial)
38-
* [Ruby API](rubyapi-tutorial)
39-
* [PHP API](phpapi-tutorial)
40-
41-
> If your language or platform is not on this list, google for "JWT or JSON Web Token {your platform}". It is likely you will find an implementation. Or let us know: [[email protected]](mailto:[email protected])
42-
32+
To validate the token on the server side, we have tutorials for several platforms and languages to get you up and running as quickly as possible. Look at the Web APIs section on the sidebar.

sdk2/index.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ if account.loggedIn && !embedded
88
option(value="#{client.clientID}") #{client.name}
99

1010
div
11-
label Select the widget mode:
11+
label Select how you want to trigger login:
1212
select#widget-chooser
1313
option(value="login") Login Widget - Modal
1414
option(value="embedded") Login Widget - Inside a DIV
15-
option(value="redirect") Login Link
16-
option(value="custom") JavaScript API
15+
option(value="custom") Custom UI
16+
option(value="redirect") Plain Link
1717

1818

1919
p This is how it will look on a browser...

sdk2/snippets/custom.html

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<button class="signin-google">Sign in with Google</button><br>
2-
<button class="signin-facebook">Sign in with Facebook</button><br>
3-
<button class="signin-waad">Sign in with Windows Azure AD</button><br>
4-
<button class="signin-etc">Sign in with ...</button><br><p>--- or ---</p>
5-
<label>User</label><input type="text" id="username"><br>
1+
<button class="signin-google">Sign in with Google (redirect)</button><br>
2+
<button class="signin-google-popup">Sign in with Google (popup)</button><br>
3+
<br><p>--- or ---</p>
4+
<label>Email</label><input type="text" id="email"><br>
65
<label>Password</label><input type="password" id="password"><br>
7-
<button class="signin-db">Sign in with Username/Password</button>
6+
<button class="signin-db">Sign in with Email/Password</button>
87

98
<script src="<%= auth0js_url %>"></script>
109
<script src="http://code.jquery.com/jquery.js"></script>
@@ -20,30 +19,46 @@
2019
callbackURL: '<%= account.callback %>'
2120
});<% } %>
2221

22+
// sign-in with social provider with plain redirect
2323
$('.signin-google').on('click', function() {
24-
auth0.login({connection: 'google-oauth2'});
24+
auth0.signin({connection: 'google-oauth2'}); // use connection identifier
2525
});
2626

27-
$('.signin-facebook').on('click', function() {
28-
auth0.login({connection: 'facebook'});
27+
<% if (callbackOnHash) { %>
28+
// authentication result comes back in `window.location.hash`
29+
widget.getProfile(window.location.hash, function (err, profile, id_token, access_token, state) {
30+
/*
31+
store the profile and id_token in a cookie or local storage
32+
$.cookie('profile', profile);
33+
$.cookie('id_token', id_token);
34+
*/
2935
});
36+
<% } %>
3037

31-
$('.signin-waad').on('click', function() {
32-
auth0.login({connection: 'tenant.onmicrosoft.com'});
33-
});
34-
35-
$('.signin-etc').on('click', function() {
36-
auth0.login({connection: 'connection-name'});
38+
// sign-in with social provider using a popup (window.open)
39+
$('.signin-google-popup').on('click', function() {
40+
auth0.signin({popup: true, connection: 'google-oauth2'},
41+
function(err, profile, id_token, access_token, state) {
42+
/*
43+
store the profile and id_token in a cookie or local storage
44+
$.cookie('profile', profile);
45+
$.cookie('id_token', id_token);
46+
*/
47+
});
3748
});
3849

3950
$('.signin-db').on('click', function() {
40-
auth0.login({
51+
auth0.signin({
4152
connection: 'foo',
4253
username: 'bar',
4354
password: 'foobar'
4455
},
45-
function (err) {
46-
// invalid user/password
56+
function (err, profile, id_token, access_token, state) {
57+
/*
58+
store the profile and id_token in a cookie or local storage
59+
$.cookie('profile', profile);
60+
$.cookie('id_token', id_token);
61+
*/
4762
});
4863
});
4964
</script>

sdk2/snippets/embedded.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
});<% } %>
1818
<% if (callbackOnHash) { %>
1919
// authentication result comes back in `window.location.hash`
20-
widget.parseHash(window.location.hash, function (profile, id_token, access_token, state) {
20+
widget.getProfile(window.location.hash, function (err, profile, id_token, access_token, state) {
2121
/*
2222
store the profile and id_token in a cookie or local storage
2323
$.cookie('profile', profile);

sdk2/snippets/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
});<% } %>
1515
<% if (callbackOnHash) { %>
1616
// authentication result comes back in `window.location.hash`
17-
widget.parseHash(window.location.hash, function (profile, id_token, access_token, state) {
17+
widget.getProfile(window.location.hash, function (err, profile, id_token, access_token, state) {
1818
/*
1919
store the profile and id_token in a cookie or local storage
2020
$.cookie('profile', profile);

0 commit comments

Comments
 (0)